142 #ifndef PY_SSIZE_T_CLEAN
143 #define PY_SSIZE_T_CLEAN
147 #error Python headers needed to compile C extensions, please install development version of Python.
148 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
149 #error Cython requires Python 2.6+ or Python 3.3+.
151 #define CYTHON_ABI "0_29_36"
152 #define CYTHON_HEX_VERSION 0x001D24F0
153 #define CYTHON_FUTURE_DIVISION 1
156 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
158 #if !defined(WIN32) && !defined(MS_WINDOWS)
170 #define DL_IMPORT(t) t
173 #define DL_EXPORT(t) t
175 #define __PYX_COMMA ,
176 #ifndef HAVE_LONG_LONG
177 #if PY_VERSION_HEX >= 0x02070000
178 #define HAVE_LONG_LONG
182 #define PY_LONG_LONG LONG_LONG
185 #define Py_HUGE_VAL HUGE_VAL
188 #define CYTHON_COMPILING_IN_PYPY 1
189 #define CYTHON_COMPILING_IN_PYSTON 0
190 #define CYTHON_COMPILING_IN_CPYTHON 0
191 #define CYTHON_COMPILING_IN_NOGIL 0
192 #undef CYTHON_USE_TYPE_SLOTS
193 #define CYTHON_USE_TYPE_SLOTS 0
194 #undef CYTHON_USE_PYTYPE_LOOKUP
195 #define CYTHON_USE_PYTYPE_LOOKUP 0
196 #if PY_VERSION_HEX < 0x03050000
197 #undef CYTHON_USE_ASYNC_SLOTS
198 #define CYTHON_USE_ASYNC_SLOTS 0
199 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
200 #define CYTHON_USE_ASYNC_SLOTS 1
202 #undef CYTHON_USE_PYLIST_INTERNALS
203 #define CYTHON_USE_PYLIST_INTERNALS 0
204 #undef CYTHON_USE_UNICODE_INTERNALS
205 #define CYTHON_USE_UNICODE_INTERNALS 0
206 #undef CYTHON_USE_UNICODE_WRITER
207 #define CYTHON_USE_UNICODE_WRITER 0
208 #undef CYTHON_USE_PYLONG_INTERNALS
209 #define CYTHON_USE_PYLONG_INTERNALS 0
210 #undef CYTHON_AVOID_BORROWED_REFS
211 #define CYTHON_AVOID_BORROWED_REFS 1
212 #undef CYTHON_ASSUME_SAFE_MACROS
213 #define CYTHON_ASSUME_SAFE_MACROS 0
214 #undef CYTHON_UNPACK_METHODS
215 #define CYTHON_UNPACK_METHODS 0
216 #undef CYTHON_FAST_THREAD_STATE
217 #define CYTHON_FAST_THREAD_STATE 0
218 #undef CYTHON_FAST_PYCALL
219 #define CYTHON_FAST_PYCALL 0
220 #if PY_VERSION_HEX < 0x03090000
221 #undef CYTHON_PEP489_MULTI_PHASE_INIT
222 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
223 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
224 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
226 #undef CYTHON_USE_TP_FINALIZE
227 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
228 #undef CYTHON_USE_DICT_VERSIONS
229 #define CYTHON_USE_DICT_VERSIONS 0
230 #undef CYTHON_USE_EXC_INFO_STACK
231 #define CYTHON_USE_EXC_INFO_STACK 0
232 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
233 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
235 #elif defined(PYSTON_VERSION)
236 #define CYTHON_COMPILING_IN_PYPY 0
237 #define CYTHON_COMPILING_IN_PYSTON 1
238 #define CYTHON_COMPILING_IN_CPYTHON 0
239 #define CYTHON_COMPILING_IN_NOGIL 0
240 #ifndef CYTHON_USE_TYPE_SLOTS
241 #define CYTHON_USE_TYPE_SLOTS 1
243 #undef CYTHON_USE_PYTYPE_LOOKUP
244 #define CYTHON_USE_PYTYPE_LOOKUP 0
245 #undef CYTHON_USE_ASYNC_SLOTS
246 #define CYTHON_USE_ASYNC_SLOTS 0
247 #undef CYTHON_USE_PYLIST_INTERNALS
248 #define CYTHON_USE_PYLIST_INTERNALS 0
249 #ifndef CYTHON_USE_UNICODE_INTERNALS
250 #define CYTHON_USE_UNICODE_INTERNALS 1
252 #undef CYTHON_USE_UNICODE_WRITER
253 #define CYTHON_USE_UNICODE_WRITER 0
254 #undef CYTHON_USE_PYLONG_INTERNALS
255 #define CYTHON_USE_PYLONG_INTERNALS 0
256 #ifndef CYTHON_AVOID_BORROWED_REFS
257 #define CYTHON_AVOID_BORROWED_REFS 0
259 #ifndef CYTHON_ASSUME_SAFE_MACROS
260 #define CYTHON_ASSUME_SAFE_MACROS 1
262 #ifndef CYTHON_UNPACK_METHODS
263 #define CYTHON_UNPACK_METHODS 1
265 #undef CYTHON_FAST_THREAD_STATE
266 #define CYTHON_FAST_THREAD_STATE 0
267 #undef CYTHON_FAST_PYCALL
268 #define CYTHON_FAST_PYCALL 0
269 #undef CYTHON_PEP489_MULTI_PHASE_INIT
270 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
271 #undef CYTHON_USE_TP_FINALIZE
272 #define CYTHON_USE_TP_FINALIZE 0
273 #undef CYTHON_USE_DICT_VERSIONS
274 #define CYTHON_USE_DICT_VERSIONS 0
275 #undef CYTHON_USE_EXC_INFO_STACK
276 #define CYTHON_USE_EXC_INFO_STACK 0
277 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
278 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
280 #elif defined(PY_NOGIL)
281 #define CYTHON_COMPILING_IN_PYPY 0
282 #define CYTHON_COMPILING_IN_PYSTON 0
283 #define CYTHON_COMPILING_IN_CPYTHON 0
284 #define CYTHON_COMPILING_IN_NOGIL 1
285 #ifndef CYTHON_USE_TYPE_SLOTS
286 #define CYTHON_USE_TYPE_SLOTS 1
288 #undef CYTHON_USE_PYTYPE_LOOKUP
289 #define CYTHON_USE_PYTYPE_LOOKUP 0
290 #ifndef CYTHON_USE_ASYNC_SLOTS
291 #define CYTHON_USE_ASYNC_SLOTS 1
293 #undef CYTHON_USE_PYLIST_INTERNALS
294 #define CYTHON_USE_PYLIST_INTERNALS 0
295 #ifndef CYTHON_USE_UNICODE_INTERNALS
296 #define CYTHON_USE_UNICODE_INTERNALS 1
298 #undef CYTHON_USE_UNICODE_WRITER
299 #define CYTHON_USE_UNICODE_WRITER 0
300 #undef CYTHON_USE_PYLONG_INTERNALS
301 #define CYTHON_USE_PYLONG_INTERNALS 0
302 #ifndef CYTHON_AVOID_BORROWED_REFS
303 #define CYTHON_AVOID_BORROWED_REFS 0
305 #ifndef CYTHON_ASSUME_SAFE_MACROS
306 #define CYTHON_ASSUME_SAFE_MACROS 1
308 #ifndef CYTHON_UNPACK_METHODS
309 #define CYTHON_UNPACK_METHODS 1
311 #undef CYTHON_FAST_THREAD_STATE
312 #define CYTHON_FAST_THREAD_STATE 0
313 #undef CYTHON_FAST_PYCALL
314 #define CYTHON_FAST_PYCALL 0
315 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
316 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
318 #ifndef CYTHON_USE_TP_FINALIZE
319 #define CYTHON_USE_TP_FINALIZE 1
321 #undef CYTHON_USE_DICT_VERSIONS
322 #define CYTHON_USE_DICT_VERSIONS 0
323 #undef CYTHON_USE_EXC_INFO_STACK
324 #define CYTHON_USE_EXC_INFO_STACK 0
326 #define CYTHON_COMPILING_IN_PYPY 0
327 #define CYTHON_COMPILING_IN_PYSTON 0
328 #define CYTHON_COMPILING_IN_CPYTHON 1
329 #define CYTHON_COMPILING_IN_NOGIL 0
330 #ifndef CYTHON_USE_TYPE_SLOTS
331 #define CYTHON_USE_TYPE_SLOTS 1
333 #if PY_VERSION_HEX < 0x02070000
334 #undef CYTHON_USE_PYTYPE_LOOKUP
335 #define CYTHON_USE_PYTYPE_LOOKUP 0
336 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
337 #define CYTHON_USE_PYTYPE_LOOKUP 1
339 #if PY_MAJOR_VERSION < 3
340 #undef CYTHON_USE_ASYNC_SLOTS
341 #define CYTHON_USE_ASYNC_SLOTS 0
342 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
343 #define CYTHON_USE_ASYNC_SLOTS 1
345 #if PY_VERSION_HEX < 0x02070000
346 #undef CYTHON_USE_PYLONG_INTERNALS
347 #define CYTHON_USE_PYLONG_INTERNALS 0
348 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
349 #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5)
351 #ifndef CYTHON_USE_PYLIST_INTERNALS
352 #define CYTHON_USE_PYLIST_INTERNALS 1
354 #ifndef CYTHON_USE_UNICODE_INTERNALS
355 #define CYTHON_USE_UNICODE_INTERNALS 1
357 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
358 #undef CYTHON_USE_UNICODE_WRITER
359 #define CYTHON_USE_UNICODE_WRITER 0
360 #elif !defined(CYTHON_USE_UNICODE_WRITER)
361 #define CYTHON_USE_UNICODE_WRITER 1
363 #ifndef CYTHON_AVOID_BORROWED_REFS
364 #define CYTHON_AVOID_BORROWED_REFS 0
366 #ifndef CYTHON_ASSUME_SAFE_MACROS
367 #define CYTHON_ASSUME_SAFE_MACROS 1
369 #ifndef CYTHON_UNPACK_METHODS
370 #define CYTHON_UNPACK_METHODS 1
372 #if PY_VERSION_HEX >= 0x030B00A4
373 #undef CYTHON_FAST_THREAD_STATE
374 #define CYTHON_FAST_THREAD_STATE 0
375 #elif !defined(CYTHON_FAST_THREAD_STATE)
376 #define CYTHON_FAST_THREAD_STATE 1
378 #ifndef CYTHON_FAST_PYCALL
379 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
381 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
382 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
384 #ifndef CYTHON_USE_TP_FINALIZE
385 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
387 #ifndef CYTHON_USE_DICT_VERSIONS
388 #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5))
390 #if PY_VERSION_HEX >= 0x030B00A4
391 #undef CYTHON_USE_EXC_INFO_STACK
392 #define CYTHON_USE_EXC_INFO_STACK 0
393 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
394 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
396 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
397 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
400 #if !defined(CYTHON_FAST_PYCCALL)
401 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
403 #if CYTHON_USE_PYLONG_INTERNALS
404 #if PY_MAJOR_VERSION < 3
405 #include "longintrepr.h"
411 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
414 #ifndef __has_attribute
415 #define __has_attribute(x) 0
417 #ifndef __has_cpp_attribute
418 #define __has_cpp_attribute(x) 0
420 #ifndef CYTHON_RESTRICT
421 #if defined(__GNUC__)
422 #define CYTHON_RESTRICT __restrict__
423 #elif defined(_MSC_VER) && _MSC_VER >= 1400
424 #define CYTHON_RESTRICT __restrict
425 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
426 #define CYTHON_RESTRICT restrict
428 #define CYTHON_RESTRICT
431 #ifndef CYTHON_UNUSED
432 # if defined(__GNUC__)
433 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
434 # define CYTHON_UNUSED __attribute__ ((__unused__))
436 # define CYTHON_UNUSED
438 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
439 # define CYTHON_UNUSED __attribute__ ((__unused__))
441 # define CYTHON_UNUSED
444 #ifndef CYTHON_MAYBE_UNUSED_VAR
445 # if defined(__cplusplus)
446 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
448 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
451 #ifndef CYTHON_NCP_UNUSED
452 # if CYTHON_COMPILING_IN_CPYTHON
453 # define CYTHON_NCP_UNUSED
455 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
458 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
460 #ifndef _MSC_STDINT_H_
462 typedef unsigned char uint8_t;
463 typedef unsigned int uint32_t;
465 typedef unsigned __int8 uint8_t;
466 typedef unsigned __int32 uint32_t;
472 #ifndef CYTHON_FALLTHROUGH
473 #if defined(__cplusplus) && __cplusplus >= 201103L
474 #if __has_cpp_attribute(fallthrough)
475 #define CYTHON_FALLTHROUGH [[fallthrough]]
476 #elif __has_cpp_attribute(clang::fallthrough)
477 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
478 #elif __has_cpp_attribute(gnu::fallthrough)
479 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
482 #ifndef CYTHON_FALLTHROUGH
483 #if __has_attribute(fallthrough)
484 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
486 #define CYTHON_FALLTHROUGH
489 #if defined(__clang__ ) && defined(__apple_build_version__)
490 #if __apple_build_version__ < 7000000
491 #undef CYTHON_FALLTHROUGH
492 #define CYTHON_FALLTHROUGH
498 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
500 #ifndef CYTHON_INLINE
501 #if defined(__clang__)
502 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
504 #define CYTHON_INLINE inline
508 void __Pyx_call_destructor(T& x) {
512 class __Pyx_FakeReference {
514 __Pyx_FakeReference() : ptr(NULL) { }
515 __Pyx_FakeReference(
const T& ref) : ptr(const_cast<T*>(&ref)) { }
516 T *operator->() {
return ptr; }
517 T *operator&() {
return ptr; }
518 operator T&() {
return *ptr; }
519 template<
typename U>
bool operator ==(U other) {
return *ptr == other; }
520 template<
typename U>
bool operator !=(U other) {
return *ptr != other; }
525 #define __PYX_BUILD_PY_SSIZE_T "n"
526 #define CYTHON_FORMAT_SSIZE_T "z"
527 #if PY_MAJOR_VERSION < 3
528 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
529 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
530 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
531 #define __Pyx_DefaultClassType PyClass_Type
533 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
534 #define __Pyx_DefaultClassType PyType_Type
535 #if PY_VERSION_HEX >= 0x030B00A1
536 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(
int a,
int k,
int l,
int s,
int f,
537 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
538 PyObject *fv, PyObject *cell, PyObject* fn,
539 PyObject *name,
int fline, PyObject *lnos) {
540 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
541 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
542 const char *fn_cstr=NULL;
543 const char *name_cstr=NULL;
544 PyCodeObject* co=NULL;
545 PyObject *type, *value, *traceback;
546 PyErr_Fetch(&type, &value, &traceback);
547 if (!(kwds=PyDict_New()))
goto end;
548 if (!(argcount=PyLong_FromLong(a)))
goto end;
549 if (PyDict_SetItemString(kwds,
"co_argcount", argcount) != 0)
goto end;
550 if (!(posonlyargcount=PyLong_FromLong(0)))
goto end;
551 if (PyDict_SetItemString(kwds,
"co_posonlyargcount", posonlyargcount) != 0)
goto end;
552 if (!(kwonlyargcount=PyLong_FromLong(k)))
goto end;
553 if (PyDict_SetItemString(kwds,
"co_kwonlyargcount", kwonlyargcount) != 0)
goto end;
554 if (!(nlocals=PyLong_FromLong(l)))
goto end;
555 if (PyDict_SetItemString(kwds,
"co_nlocals", nlocals) != 0)
goto end;
556 if (!(stacksize=PyLong_FromLong(s)))
goto end;
557 if (PyDict_SetItemString(kwds,
"co_stacksize", stacksize) != 0)
goto end;
558 if (!(flags=PyLong_FromLong(f)))
goto end;
559 if (PyDict_SetItemString(kwds,
"co_flags", flags) != 0)
goto end;
560 if (PyDict_SetItemString(kwds,
"co_code", code) != 0)
goto end;
561 if (PyDict_SetItemString(kwds,
"co_consts", c) != 0)
goto end;
562 if (PyDict_SetItemString(kwds,
"co_names", n) != 0)
goto end;
563 if (PyDict_SetItemString(kwds,
"co_varnames", v) != 0)
goto end;
564 if (PyDict_SetItemString(kwds,
"co_freevars", fv) != 0)
goto end;
565 if (PyDict_SetItemString(kwds,
"co_cellvars", cell) != 0)
goto end;
566 if (PyDict_SetItemString(kwds,
"co_linetable", lnos) != 0)
goto end;
567 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL)))
goto end;
568 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL)))
goto end;
569 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline)))
goto end;
570 if (!(replace = PyObject_GetAttrString((PyObject*)co,
"replace")))
goto cleanup_code_too;
571 if (!(empty = PyTuple_New(0)))
goto cleanup_code_too;
572 if (!(call_result = PyObject_Call(replace, empty, kwds)))
goto cleanup_code_too;
573 Py_XDECREF((PyObject*)co);
574 co = (PyCodeObject*)call_result;
578 Py_XDECREF((PyObject*)co);
583 Py_XDECREF(argcount);
584 Py_XDECREF(posonlyargcount);
585 Py_XDECREF(kwonlyargcount);
587 Py_XDECREF(stacksize);
589 Py_XDECREF(call_result);
592 PyErr_Restore(type, value, traceback);
597 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
598 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
600 #define __Pyx_DefaultClassType PyType_Type
602 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
603 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
605 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
607 #ifndef Py_TPFLAGS_CHECKTYPES
608 #define Py_TPFLAGS_CHECKTYPES 0
610 #ifndef Py_TPFLAGS_HAVE_INDEX
611 #define Py_TPFLAGS_HAVE_INDEX 0
613 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
614 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
616 #ifndef Py_TPFLAGS_HAVE_FINALIZE
617 #define Py_TPFLAGS_HAVE_FINALIZE 0
619 #ifndef METH_STACKLESS
620 #define METH_STACKLESS 0
622 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
623 #ifndef METH_FASTCALL
624 #define METH_FASTCALL 0x80
626 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
627 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
628 Py_ssize_t nargs, PyObject *kwnames);
630 #define __Pyx_PyCFunctionFast _PyCFunctionFast
631 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
633 #if CYTHON_FAST_PYCCALL
634 #define __Pyx_PyFastCFunction_Check(func)\
635 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
637 #define __Pyx_PyFastCFunction_Check(func) 0
639 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
640 #define PyObject_Malloc(s) PyMem_Malloc(s)
641 #define PyObject_Free(p) PyMem_Free(p)
642 #define PyObject_Realloc(p) PyMem_Realloc(p)
644 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
645 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
646 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
647 #define PyMem_RawFree(p) PyMem_Free(p)
649 #if CYTHON_COMPILING_IN_PYSTON
650 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
651 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
653 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
654 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
656 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
657 #define __Pyx_PyThreadState_Current PyThreadState_GET()
658 #elif PY_VERSION_HEX >= 0x03060000
659 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
660 #elif PY_VERSION_HEX >= 0x03000000
661 #define __Pyx_PyThreadState_Current PyThreadState_GET()
663 #define __Pyx_PyThreadState_Current _PyThreadState_Current
665 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
666 #include "pythread.h"
667 #define Py_tss_NEEDS_INIT 0
668 typedef int Py_tss_t;
669 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
670 *key = PyThread_create_key();
673 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
674 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
675 *key = Py_tss_NEEDS_INIT;
678 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
681 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
682 return *key != Py_tss_NEEDS_INIT;
684 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
685 PyThread_delete_key(*key);
686 *key = Py_tss_NEEDS_INIT;
688 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
689 return PyThread_set_key_value(*key, value);
691 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
692 return PyThread_get_key_value(*key);
695 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
696 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
698 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
700 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
701 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
702 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
704 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
705 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
707 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
708 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
710 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
712 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
713 #define CYTHON_PEP393_ENABLED 1
714 #if PY_VERSION_HEX >= 0x030C0000
715 #define __Pyx_PyUnicode_READY(op) (0)
717 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
718 0 : _PyUnicode_Ready((PyObject *)(op)))
720 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
721 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
722 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
723 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
724 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
725 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
726 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
727 #if PY_VERSION_HEX >= 0x030C0000
728 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
730 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
731 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
733 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
737 #define CYTHON_PEP393_ENABLED 0
738 #define PyUnicode_1BYTE_KIND 1
739 #define PyUnicode_2BYTE_KIND 2
740 #define PyUnicode_4BYTE_KIND 4
741 #define __Pyx_PyUnicode_READY(op) (0)
742 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
743 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
744 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
745 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
746 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
747 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
748 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
749 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
751 #if CYTHON_COMPILING_IN_PYPY
752 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
753 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
755 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
756 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
757 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
759 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
760 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
762 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
763 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
765 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
766 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
768 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
769 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
770 #if PY_MAJOR_VERSION >= 3
771 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
773 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
775 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
776 #define PyObject_ASCII(o) PyObject_Repr(o)
778 #if PY_MAJOR_VERSION >= 3
779 #define PyBaseString_Type PyUnicode_Type
780 #define PyStringObject PyUnicodeObject
781 #define PyString_Type PyUnicode_Type
782 #define PyString_Check PyUnicode_Check
783 #define PyString_CheckExact PyUnicode_CheckExact
784 #ifndef PyObject_Unicode
785 #define PyObject_Unicode PyObject_Str
788 #if PY_MAJOR_VERSION >= 3
789 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
790 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
792 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
793 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
795 #ifndef PySet_CheckExact
796 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
798 #if PY_VERSION_HEX >= 0x030900A4
799 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
800 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
802 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
803 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
805 #if CYTHON_ASSUME_SAFE_MACROS
806 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
808 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
810 #if PY_MAJOR_VERSION >= 3
811 #define PyIntObject PyLongObject
812 #define PyInt_Type PyLong_Type
813 #define PyInt_Check(op) PyLong_Check(op)
814 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
815 #define PyInt_FromString PyLong_FromString
816 #define PyInt_FromUnicode PyLong_FromUnicode
817 #define PyInt_FromLong PyLong_FromLong
818 #define PyInt_FromSize_t PyLong_FromSize_t
819 #define PyInt_FromSsize_t PyLong_FromSsize_t
820 #define PyInt_AsLong PyLong_AsLong
821 #define PyInt_AS_LONG PyLong_AS_LONG
822 #define PyInt_AsSsize_t PyLong_AsSsize_t
823 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
824 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
825 #define PyNumber_Int PyNumber_Long
827 #if PY_MAJOR_VERSION >= 3
828 #define PyBoolObject PyLongObject
830 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
831 #ifndef PyUnicode_InternFromString
832 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
835 #if PY_VERSION_HEX < 0x030200A4
836 typedef long Py_hash_t;
837 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
838 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
840 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
841 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
843 #if PY_MAJOR_VERSION >= 3
844 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
846 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
848 #if CYTHON_USE_ASYNC_SLOTS
849 #if PY_VERSION_HEX >= 0x030500B1
850 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
851 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
853 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
856 #define __Pyx_PyType_AsAsync(obj) NULL
858 #ifndef __Pyx_PyAsyncMethodsStruct
863 } __Pyx_PyAsyncMethodsStruct;
866 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
867 #if !defined(_USE_MATH_DEFINES)
868 #define _USE_MATH_DEFINES
873 #define __PYX_NAN() ((float) NAN)
875 static CYTHON_INLINE
float __PYX_NAN() {
877 memset(&value, 0xFF,
sizeof(value));
881 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
882 #define __Pyx_truncl trunc
884 #define __Pyx_truncl truncl
887 #define __PYX_MARK_ERR_POS(f_index, lineno) \
888 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
889 #define __PYX_ERR(f_index, lineno, Ln_error) \
890 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
892 #ifndef __PYX_EXTERN_C
894 #define __PYX_EXTERN_C extern "C"
896 #define __PYX_EXTERN_C extern
900 #define __PYX_HAVE__imate___c_trace_estimator__py_c_trace_estimator
901 #define __PYX_HAVE_API__imate___c_trace_estimator__py_c_trace_estimator
923 #include "pythread.h"
930 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
931 #define CYTHON_WITHOUT_ASSERTIONS
934 typedef struct {PyObject **p;
const char *s;
const Py_ssize_t n;
const char* encoding;
935 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
937 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
938 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
939 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
940 #define __PYX_DEFAULT_STRING_ENCODING ""
941 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
942 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
943 #define __Pyx_uchar_cast(c) ((unsigned char)c)
944 #define __Pyx_long_cast(x) ((long)x)
945 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
946 (sizeof(type) < sizeof(Py_ssize_t)) ||\
947 (sizeof(type) > sizeof(Py_ssize_t) &&\
948 likely(v < (type)PY_SSIZE_T_MAX ||\
949 v == (type)PY_SSIZE_T_MAX) &&\
950 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
951 v == (type)PY_SSIZE_T_MIN))) ||\
952 (sizeof(type) == sizeof(Py_ssize_t) &&\
953 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
954 v == (type)PY_SSIZE_T_MAX))) )
955 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
956 return (
size_t) i < (size_t) limit;
958 #if defined (__cplusplus) && __cplusplus >= 201103L
960 #define __Pyx_sst_abs(value) std::abs(value)
961 #elif SIZEOF_INT >= SIZEOF_SIZE_T
962 #define __Pyx_sst_abs(value) abs(value)
963 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
964 #define __Pyx_sst_abs(value) labs(value)
965 #elif defined (_MSC_VER)
966 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
967 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
968 #define __Pyx_sst_abs(value) llabs(value)
969 #elif defined (__GNUC__)
970 #define __Pyx_sst_abs(value) __builtin_llabs(value)
972 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
974 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
975 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
976 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
977 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
978 #define __Pyx_PyBytes_FromString PyBytes_FromString
979 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
980 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
981 #if PY_MAJOR_VERSION < 3
982 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
983 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
985 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
986 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
988 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
989 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
990 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
991 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
992 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
993 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
994 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
995 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
996 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
997 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
998 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
999 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
1000 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
1001 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
1002 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
1003 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
1004 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *u) {
1005 const Py_UNICODE *u_end = u;
1007 return (
size_t)(u_end - u - 1);
1009 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
1010 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
1011 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
1012 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
1013 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
1014 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
1015 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
1016 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
1017 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
1018 #define __Pyx_PySequence_Tuple(obj)\
1019 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
1020 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
1021 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
1022 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
1023 #if CYTHON_ASSUME_SAFE_MACROS
1024 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
1026 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1028 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
1029 #if PY_MAJOR_VERSION >= 3
1030 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
1032 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
1034 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
1035 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1036 static int __Pyx_sys_getdefaultencoding_not_ascii;
1037 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
1039 PyObject* default_encoding = NULL;
1040 PyObject* ascii_chars_u = NULL;
1041 PyObject* ascii_chars_b = NULL;
1042 const char* default_encoding_c;
1043 sys = PyImport_ImportModule(
"sys");
1045 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
1047 if (!default_encoding)
goto bad;
1048 default_encoding_c = PyBytes_AsString(default_encoding);
1049 if (!default_encoding_c)
goto bad;
1050 if (strcmp(default_encoding_c,
"ascii") == 0) {
1051 __Pyx_sys_getdefaultencoding_not_ascii = 0;
1053 char ascii_chars[128];
1055 for (c = 0; c < 128; c++) {
1058 __Pyx_sys_getdefaultencoding_not_ascii = 1;
1059 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1060 if (!ascii_chars_u)
goto bad;
1061 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1062 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1065 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1066 default_encoding_c);
1069 Py_DECREF(ascii_chars_u);
1070 Py_DECREF(ascii_chars_b);
1072 Py_DECREF(default_encoding);
1075 Py_XDECREF(default_encoding);
1076 Py_XDECREF(ascii_chars_u);
1077 Py_XDECREF(ascii_chars_b);
1081 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1082 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1084 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1085 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1086 static char* __PYX_DEFAULT_STRING_ENCODING;
1087 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
1089 PyObject* default_encoding = NULL;
1090 char* default_encoding_c;
1091 sys = PyImport_ImportModule(
"sys");
1093 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
1095 if (!default_encoding)
goto bad;
1096 default_encoding_c = PyBytes_AsString(default_encoding);
1097 if (!default_encoding_c)
goto bad;
1098 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
1099 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
1100 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1101 Py_DECREF(default_encoding);
1104 Py_XDECREF(default_encoding);
1112 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1113 #define likely(x) __builtin_expect(!!(x), 1)
1114 #define unlikely(x) __builtin_expect(!!(x), 0)
1116 #define likely(x) (x)
1117 #define unlikely(x) (x)
1119 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
1121 static PyObject *__pyx_m = NULL;
1122 static PyObject *__pyx_d;
1123 static PyObject *__pyx_b;
1124 static PyObject *__pyx_cython_runtime = NULL;
1125 static PyObject *__pyx_empty_tuple;
1126 static PyObject *__pyx_empty_bytes;
1127 static PyObject *__pyx_empty_unicode;
1128 static int __pyx_lineno;
1129 static int __pyx_clineno = 0;
1130 static const char * __pyx_cfilenm= __FILE__;
1131 static const char *__pyx_filename;
1134 #if !defined(CYTHON_CCOMPLEX)
1135 #if defined(__cplusplus)
1136 #define CYTHON_CCOMPLEX 1
1137 #elif defined(_Complex_I)
1138 #define CYTHON_CCOMPLEX 1
1140 #define CYTHON_CCOMPLEX 0
1147 #include <complex.h>
1150 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
1152 #define _Complex_I 1.0fj
1156 static const char *__pyx_f[] = {
1157 "imate/_c_trace_estimator/py_c_trace_estimator.pyx",
1158 "imate/_c_trace_estimator/lapack_api.pxi",
1160 "imate/functions/py_functions.pxd",
1161 "imate/_c_linear_operator/py_c_linear_operator.pxd",
1162 "imate/_c_linear_operator/py_c_matrix.pxd",
1163 "imate/_c_linear_operator/py_c_affine_matrix_function.pxd",
1166 struct __pyx_memoryview_obj;
1168 struct __pyx_memoryview_obj *memview;
1170 Py_ssize_t shape[8];
1171 Py_ssize_t strides[8];
1172 Py_ssize_t suboffsets[8];
1173 } __Pyx_memviewslice;
1174 #define __Pyx_MemoryView_Len(m) (m.shape[0])
1177 #include <pythread.h>
1178 #ifndef CYTHON_ATOMICS
1179 #define CYTHON_ATOMICS 1
1181 #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
1182 #define __pyx_atomic_int_type int
1183 #if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
1184 (__GNUC_MINOR__ > 1 ||\
1185 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
1186 #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1)
1187 #define __pyx_atomic_decr_aligned(value) __sync_fetch_and_sub(value, 1)
1188 #ifdef __PYX_DEBUG_ATOMICS
1189 #warning "Using GNU atomics"
1191 #elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL
1193 #undef __pyx_atomic_int_type
1194 #define __pyx_atomic_int_type long
1195 #pragma intrinsic (_InterlockedExchangeAdd)
1196 #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1)
1197 #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1)
1198 #ifdef __PYX_DEBUG_ATOMICS
1199 #pragma message ("Using MSVC atomics")
1202 #undef CYTHON_ATOMICS
1203 #define CYTHON_ATOMICS 0
1204 #ifdef __PYX_DEBUG_ATOMICS
1205 #warning "Not using atomics"
1208 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
1210 #define __pyx_add_acquisition_count(memview)\
1211 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview))
1212 #define __pyx_sub_acquisition_count(memview)\
1213 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview))
1215 #define __pyx_add_acquisition_count(memview)\
1216 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1217 #define __pyx_sub_acquisition_count(memview)\
1218 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1222 #ifndef __PYX_FORCE_INIT_THREADS
1223 #define __PYX_FORCE_INIT_THREADS 0
1227 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1228 #define __Pyx_PyGILState_Release PyGILState_Release
1229 #define __Pyx_FastGIL_Remember()
1230 #define __Pyx_FastGIL_Forget()
1231 #define __Pyx_FastGilFuncInit()
1234 #define IS_UNSIGNED(type) (((type) -1) > 0)
1235 struct __Pyx_StructField_;
1236 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
1239 struct __Pyx_StructField_* fields;
1241 size_t arraysize[8];
1247 typedef struct __Pyx_StructField_ {
1248 __Pyx_TypeInfo* type;
1251 } __Pyx_StructField;
1253 __Pyx_StructField* field;
1254 size_t parent_offset;
1255 } __Pyx_BufFmt_StackElem;
1257 __Pyx_StructField root;
1258 __Pyx_BufFmt_StackElem* head;
1260 size_t new_count, enc_count;
1261 size_t struct_alignment;
1266 char is_valid_array;
1267 } __Pyx_BufFmt_Context;
1277 typedef int __pyx_t_5imate_12_definitions_5types_IndexType;
1286 typedef int __pyx_t_5imate_12_definitions_5types_FlagType;
1295 typedef float __pyx_t_5scipy_6linalg_13cython_lapack_s;
1304 typedef double __pyx_t_5scipy_6linalg_13cython_lapack_d;
1313 typedef long double __pyx_t_5imate_18_c_trace_estimator_20py_c_trace_estimator_long_double;
1317 typedef ::std::complex< float > __pyx_t_float_complex;
1319 typedef float _Complex __pyx_t_float_complex;
1322 typedef struct {
float real, imag; } __pyx_t_float_complex;
1324 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1329 typedef ::std::complex< double > __pyx_t_double_complex;
1331 typedef double _Complex __pyx_t_double_complex;
1334 typedef struct {
double real, imag; } __pyx_t_double_complex;
1336 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1340 struct __pyx_obj_5imate_9functions_12py_functions_pyFunction;
1341 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator;
1342 struct __pyx_obj_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix;
1343 struct __pyx_obj_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction;
1344 struct __pyx_array_obj;
1345 struct __pyx_MemviewEnum_obj;
1346 struct __pyx_memoryview_obj;
1347 struct __pyx_memoryviewslice_obj;
1356 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewLongIndexType;
1365 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType;
1374 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType;
1383 typedef double (*__pyx_t_5imate_12_definitions_5types_kernel_type)(
double const ,
double const );
1392 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_cselect1(__pyx_t_float_complex *);
1401 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_cselect2(__pyx_t_float_complex *, __pyx_t_float_complex *);
1410 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_dselect2(__pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *);
1419 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_dselect3(__pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *);
1428 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_sselect2(__pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *);
1437 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_sselect3(__pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *);
1446 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_zselect1(__pyx_t_double_complex *);
1455 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_zselect2(__pyx_t_double_complex *, __pyx_t_double_complex *);
1464 struct __pyx_obj_5imate_9functions_12py_functions_pyFunction {
1466 struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *__pyx_vtab;
1478 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator {
1480 struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_vtab;
1484 char *data_type_name;
1485 char *long_index_type_name;
1486 __pyx_t_5imate_12_definitions_5types_IndexType num_parameters;
1487 PyObject *parameters;
1498 struct __pyx_obj_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix {
1499 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator __pyx_base;
1501 PyObject *A_indices_copy;
1502 PyObject *A_index_pointer_copy;
1513 struct __pyx_obj_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction {
1514 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator __pyx_base;
1517 PyObject *A_indices_copy;
1518 PyObject *A_index_pointer_copy;
1519 PyObject *B_indices_copy;
1520 PyObject *B_index_pointer_copy;
1531 struct __pyx_array_obj {
1533 struct __pyx_vtabstruct_array *__pyx_vtab;
1539 Py_ssize_t *_strides;
1540 Py_ssize_t itemsize;
1543 void (*callback_free_data)(
void *);
1545 int dtype_is_object;
1556 struct __pyx_MemviewEnum_obj {
1569 struct __pyx_memoryview_obj {
1571 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1574 PyObject *_array_interface;
1575 PyThread_type_lock lock;
1576 __pyx_atomic_int acquisition_count[2];
1577 __pyx_atomic_int *acquisition_count_aligned_p;
1580 int dtype_is_object;
1581 __Pyx_TypeInfo *typeinfo;
1592 struct __pyx_memoryviewslice_obj {
1593 struct __pyx_memoryview_obj __pyx_base;
1594 __Pyx_memviewslice from_slice;
1595 PyObject *from_object;
1596 PyObject *(*to_object_func)(
char *);
1597 int (*to_dtype_func)(
char *, PyObject *);
1610 struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction {
1611 void (*set_function)(
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *,
Function *);
1612 Function *(*get_function)(
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *);
1614 static struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *__pyx_vtabptr_5imate_9functions_12py_functions_pyFunction;
1625 struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator {
1626 LongIndexType (*get_num_rows)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1627 LongIndexType (*get_num_columns)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1628 cLinearOperator<float> *(*get_linear_operator_float)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1629 cLinearOperator<double> *(*get_linear_operator_double)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1630 cLinearOperator<long double> *(*get_linear_operator_long_double)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1631 void (*dot)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, PyObject *,
int __pyx_skip_dispatch);
1632 void (*transpose_dot)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, PyObject *,
int __pyx_skip_dispatch);
1634 static struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_vtabptr_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator;
1645 struct __pyx_vtabstruct_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix {
1646 struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator __pyx_base;
1648 static struct __pyx_vtabstruct_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix *__pyx_vtabptr_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix;
1659 struct __pyx_vtabstruct_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction {
1660 struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator __pyx_base;
1662 static struct __pyx_vtabstruct_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction *__pyx_vtabptr_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction;
1673 struct __pyx_vtabstruct_array {
1674 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1676 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1687 struct __pyx_vtabstruct_memoryview {
1688 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1689 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1690 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1691 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1692 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1693 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1694 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1696 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1707 struct __pyx_vtabstruct__memoryviewslice {
1708 struct __pyx_vtabstruct_memoryview __pyx_base;
1710 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1714 #ifndef CYTHON_REFNANNY
1715 #define CYTHON_REFNANNY 0
1719 void (*INCREF)(
void*, PyObject*, int);
1720 void (*DECREF)(
void*, PyObject*, int);
1721 void (*GOTREF)(
void*, PyObject*, int);
1722 void (*GIVEREF)(
void*, PyObject*, int);
1723 void* (*SetupContext)(
const char*, int,
const char*);
1724 void (*FinishContext)(
void**);
1725 } __Pyx_RefNannyAPIStruct;
1726 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1727 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1728 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1730 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1732 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1733 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1734 PyGILState_Release(__pyx_gilstate_save);\
1736 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1739 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1740 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1742 #define __Pyx_RefNannyFinishContext()\
1743 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1744 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1745 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1746 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1747 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1748 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1749 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1750 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1751 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1753 #define __Pyx_RefNannyDeclarations
1754 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1755 #define __Pyx_RefNannyFinishContext()
1756 #define __Pyx_INCREF(r) Py_INCREF(r)
1757 #define __Pyx_DECREF(r) Py_DECREF(r)
1758 #define __Pyx_GOTREF(r)
1759 #define __Pyx_GIVEREF(r)
1760 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1761 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1762 #define __Pyx_XGOTREF(r)
1763 #define __Pyx_XGIVEREF(r)
1765 #define __Pyx_XDECREF_SET(r, v) do {\
1766 PyObject *tmp = (PyObject *) r;\
1767 r = v; __Pyx_XDECREF(tmp);\
1769 #define __Pyx_DECREF_SET(r, v) do {\
1770 PyObject *tmp = (PyObject *) r;\
1771 r = v; __Pyx_DECREF(tmp);\
1773 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1774 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1777 #if CYTHON_USE_TYPE_SLOTS
1778 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1780 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1784 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1787 #if CYTHON_FAST_THREAD_STATE
1788 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1789 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1790 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1792 #define __Pyx_PyThreadState_declare
1793 #define __Pyx_PyThreadState_assign
1794 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1798 #if CYTHON_FAST_THREAD_STATE
1799 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1800 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1801 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1802 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1803 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1804 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1805 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1806 #if CYTHON_COMPILING_IN_CPYTHON
1807 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1809 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1812 #define __Pyx_PyErr_Clear() PyErr_Clear()
1813 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1814 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1815 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1816 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1817 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1818 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1819 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1823 #ifndef CYTHON_PROFILE
1824 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
1825 #define CYTHON_PROFILE 0
1827 #define CYTHON_PROFILE 1
1830 #ifndef CYTHON_TRACE_NOGIL
1831 #define CYTHON_TRACE_NOGIL 0
1833 #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
1834 #define CYTHON_TRACE 1
1837 #ifndef CYTHON_TRACE
1838 #define CYTHON_TRACE 0
1841 #undef CYTHON_PROFILE_REUSE_FRAME
1843 #ifndef CYTHON_PROFILE_REUSE_FRAME
1844 #define CYTHON_PROFILE_REUSE_FRAME 0
1846 #if CYTHON_PROFILE || CYTHON_TRACE
1847 #include "compile.h"
1848 #include "frameobject.h"
1849 #include "traceback.h"
1850 #if PY_VERSION_HEX >= 0x030b00a6
1851 #ifndef Py_BUILD_CORE
1852 #define Py_BUILD_CORE 1
1854 #include "internal/pycore_frame.h"
1856 #if CYTHON_PROFILE_REUSE_FRAME
1857 #define CYTHON_FRAME_MODIFIER static
1858 #define CYTHON_FRAME_DEL(frame)
1860 #define CYTHON_FRAME_MODIFIER
1861 #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
1863 #define __Pyx_TraceDeclarations\
1864 static PyCodeObject *__pyx_frame_code = NULL;\
1865 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
1866 int __Pyx_use_tracing = 0;
1867 #define __Pyx_TraceFrameInit(codeobj)\
1868 if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
1869 #if PY_VERSION_HEX >= 0x030b00a2
1870 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1871 (unlikely((tstate)->cframe->use_tracing) &&\
1872 (!(check_tracing) || !(tstate)->tracing) &&\
1873 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1874 #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate)
1875 #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate)
1876 #elif PY_VERSION_HEX >= 0x030a00b1
1877 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1878 (unlikely((tstate)->cframe->use_tracing) &&\
1879 (!(check_tracing) || !(tstate)->tracing) &&\
1880 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1881 #define __Pyx_EnterTracing(tstate)\
1882 do { tstate->tracing++; tstate->cframe->use_tracing = 0; } while (0)
1883 #define __Pyx_LeaveTracing(tstate)\
1886 tstate->cframe->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
1887 || tstate->c_profilefunc != NULL);\
1890 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1891 (unlikely((tstate)->use_tracing) &&\
1892 (!(check_tracing) || !(tstate)->tracing) &&\
1893 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1894 #define __Pyx_EnterTracing(tstate)\
1895 do { tstate->tracing++; tstate->use_tracing = 0; } while (0)
1896 #define __Pyx_LeaveTracing(tstate)\
1899 tstate->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
1900 || tstate->c_profilefunc != NULL);\
1904 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1906 if (CYTHON_TRACE_NOGIL) {\
1907 PyThreadState *tstate;\
1908 PyGILState_STATE state = PyGILState_Ensure();\
1909 tstate = __Pyx_PyThreadState_Current;\
1910 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1911 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1913 PyGILState_Release(state);\
1914 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1917 PyThreadState* tstate = PyThreadState_GET();\
1918 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1919 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1920 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1924 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1925 { PyThreadState* tstate = PyThreadState_GET();\
1926 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1927 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1928 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1932 #define __Pyx_TraceException()\
1933 if (likely(!__Pyx_use_tracing)); else {\
1934 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1935 if (__Pyx_IsTracing(tstate, 0, 1)) {\
1936 __Pyx_EnterTracing(tstate);\
1937 PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
1939 if (CYTHON_TRACE && tstate->c_tracefunc)\
1940 tstate->c_tracefunc(\
1941 tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1942 tstate->c_profilefunc(\
1943 tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1944 Py_DECREF(exc_info);\
1946 __Pyx_LeaveTracing(tstate);\
1949 static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
1950 PyObject *type, *value, *traceback;
1951 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1952 __Pyx_EnterTracing(tstate);
1953 if (CYTHON_TRACE && tstate->c_tracefunc)
1954 tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
1955 if (tstate->c_profilefunc)
1956 tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
1957 CYTHON_FRAME_DEL(frame);
1958 __Pyx_LeaveTracing(tstate);
1959 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1962 #define __Pyx_TraceReturn(result, nogil)\
1963 if (likely(!__Pyx_use_tracing)); else {\
1965 if (CYTHON_TRACE_NOGIL) {\
1966 PyThreadState *tstate;\
1967 PyGILState_STATE state = PyGILState_Ensure();\
1968 tstate = __Pyx_PyThreadState_Current;\
1969 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1970 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1972 PyGILState_Release(state);\
1975 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1976 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1977 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1982 #define __Pyx_TraceReturn(result, nogil)\
1983 if (likely(!__Pyx_use_tracing)); else {\
1984 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1985 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1986 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1990 static PyCodeObject *__Pyx_createFrameCodeObject(
const char *funcname,
const char *srcfile,
int firstlineno);
1991 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate,
const char *funcname,
const char *srcfile,
int firstlineno);
1993 #define __Pyx_TraceDeclarations
1994 #define __Pyx_TraceFrameInit(codeobj)
1995 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
1996 #define __Pyx_TraceException()
1997 #define __Pyx_TraceReturn(result, nogil)
2000 static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame,
int lineno) {
2002 PyObject *type, *value, *traceback;
2003 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
2004 __Pyx_PyFrame_SetLineNumber(frame, lineno);
2005 __Pyx_EnterTracing(tstate);
2006 ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
2007 __Pyx_LeaveTracing(tstate);
2009 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
2013 Py_XDECREF(traceback);
2018 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
2019 if (likely(!__Pyx_use_tracing)); else {\
2021 if (CYTHON_TRACE_NOGIL) {\
2023 PyThreadState *tstate;\
2024 PyGILState_STATE state = PyGILState_Ensure();\
2025 tstate = __Pyx_PyThreadState_Current;\
2026 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2027 ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2029 PyGILState_Release(state);\
2030 if (unlikely(ret)) goto_error;\
2033 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2034 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2035 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2036 if (unlikely(ret)) goto_error;\
2041 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
2042 if (likely(!__Pyx_use_tracing)); else {\
2043 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2044 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2045 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2046 if (unlikely(ret)) goto_error;\
2051 #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
2055 static void __Pyx_WriteUnraisable(
const char *name,
int clineno,
2056 int lineno,
const char *filename,
2057 int full_traceback,
int nogil);
2063 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
2066 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
2067 #define __Pyx_MEMVIEW_DIRECT 1
2068 #define __Pyx_MEMVIEW_PTR 2
2069 #define __Pyx_MEMVIEW_FULL 4
2070 #define __Pyx_MEMVIEW_CONTIG 8
2071 #define __Pyx_MEMVIEW_STRIDED 16
2072 #define __Pyx_MEMVIEW_FOLLOW 32
2073 #define __Pyx_IS_C_CONTIG 1
2074 #define __Pyx_IS_F_CONTIG 2
2075 static int __Pyx_init_memviewslice(
2076 struct __pyx_memoryview_obj *memview,
2078 __Pyx_memviewslice *memviewslice,
2079 int memview_is_new_reference);
2080 static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
2081 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2082 static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
2083 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2084 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
2085 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
2086 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
2087 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
2088 static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
2089 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
2092 #if CYTHON_COMPILING_IN_CPYTHON
2093 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
2095 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
2099 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
2102 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2103 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2104 __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
2105 (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
2106 __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
2107 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
2108 static CYTHON_INLINE
int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
2109 int is_list,
int wraparound,
int boundscheck);
2112 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
2113 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
2116 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
2119 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
2120 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
2121 const char* function_name);
2124 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
2125 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
2126 __Pyx__ArgTypeTest(obj, type, name, exact))
2127 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
2130 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
2131 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
2132 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
2133 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
2134 (version_var) = __PYX_GET_DICT_VERSION(dict);\
2135 (cache_var) = (value);
2136 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
2137 static PY_UINT64_T __pyx_dict_version = 0;\
2138 static PyObject *__pyx_dict_cached_value = NULL;\
2139 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
2140 (VAR) = __pyx_dict_cached_value;\
2142 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
2143 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
2146 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
2147 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
2148 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
2150 #define __PYX_GET_DICT_VERSION(dict) (0)
2151 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
2152 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
2156 #if CYTHON_USE_DICT_VERSIONS
2157 #define __Pyx_GetModuleGlobalName(var, name) do {\
2158 static PY_UINT64_T __pyx_dict_version = 0;\
2159 static PyObject *__pyx_dict_cached_value = NULL;\
2160 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
2161 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
2162 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
2164 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
2165 PY_UINT64_T __pyx_dict_version;\
2166 PyObject *__pyx_dict_cached_value;\
2167 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
2169 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
2171 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
2172 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
2173 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
2177 #if CYTHON_FAST_PYCCALL
2178 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
2180 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
2184 #if CYTHON_FAST_PYCALL
2185 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
2186 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
2187 #if 1 || PY_VERSION_HEX < 0x030600B1
2188 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
2190 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
2192 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
2193 (sizeof(char [1 - 2*!(cond)]) - 1)
2194 #ifndef Py_MEMBER_SIZE
2195 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
2197 #if CYTHON_FAST_PYCALL
2198 static size_t __pyx_pyframe_localsplus_offset = 0;
2199 #include "frameobject.h"
2200 #if PY_VERSION_HEX >= 0x030b00a6
2201 #ifndef Py_BUILD_CORE
2202 #define Py_BUILD_CORE 1
2204 #include "internal/pycore_frame.h"
2206 #define __Pxy_PyFrame_Initialize_Offsets()\
2207 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
2208 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
2209 #define __Pyx_PyFrame_GetLocalsplus(frame)\
2210 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
2215 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2);
2218 #if CYTHON_COMPILING_IN_CPYTHON
2219 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
2223 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
2226 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
2229 #if PY_MAJOR_VERSION >= 3
2230 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
2232 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
2236 #define UNARY_NEG_WOULD_OVERFLOW(x)\
2237 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
2239 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2240 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
2242 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
2245 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2246 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2247 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
2248 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
2249 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
2250 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2251 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2252 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
2253 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
2254 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
2255 int wraparound,
int boundscheck);
2256 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2257 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2258 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
2259 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
2260 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
2261 int wraparound,
int boundscheck);
2262 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
2263 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
2264 int is_list,
int wraparound,
int boundscheck);
2267 #if CYTHON_USE_TYPE_SLOTS
2268 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
2270 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
2274 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *s, Py_ssize_t size,
const char *errors) {
2276 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2278 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *s, Py_ssize_t size,
const char *errors) {
2280 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2282 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *s, Py_ssize_t size,
const char *errors) {
2284 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2288 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
2289 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
2290 const char* encoding,
const char* errors,
2291 PyObject* (*decode_func)(
const char *s, Py_ssize_t size,
const char *errors));
2294 #if CYTHON_FAST_THREAD_STATE
2295 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
2296 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
2298 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
2302 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
2305 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
2308 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
2311 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
2314 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
2317 #if CYTHON_USE_EXC_INFO_STACK
2318 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
2322 #if CYTHON_FAST_THREAD_STATE
2323 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
2324 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2325 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
2326 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
2328 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
2329 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
2333 #if CYTHON_FAST_THREAD_STATE
2334 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
2335 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2337 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
2341 #if CYTHON_FAST_THREAD_STATE
2342 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2343 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2345 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2349 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
2352 #if CYTHON_COMPILING_IN_CPYTHON
2353 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2354 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2355 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2356 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2358 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2359 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2360 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2362 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2364 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2366 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2367 static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
2368 PyListObject* L = (PyListObject*) list;
2369 Py_ssize_t len = Py_SIZE(list);
2370 if (likely(L->allocated > len)) {
2372 PyList_SET_ITEM(list, len, x);
2373 __Pyx_SET_SIZE(list, len + 1);
2376 return PyList_Append(list, x);
2379 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
2383 #if !CYTHON_COMPILING_IN_PYPY
2384 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
2386 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
2387 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
2391 static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
2392 #if CYTHON_COMPILING_IN_CPYTHON
2393 PyObject* none = _PyList_Extend((PyListObject*)L, v);
2394 if (unlikely(!none))
2399 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
2404 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2405 static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2406 PyListObject* L = (PyListObject*) list;
2407 Py_ssize_t len = Py_SIZE(list);
2408 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2410 PyList_SET_ITEM(list, len, x);
2411 __Pyx_SET_SIZE(list, len + 1);
2414 return PyList_Append(list, x);
2417 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2421 #define __Pyx_init_assertions_enabled()
2422 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
2423 #define __pyx_assertions_enabled() (1)
2424 #elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API)
2425 #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
2426 #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6
2427 static int __pyx_assertions_enabled_flag;
2428 #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
2429 #undef __Pyx_init_assertions_enabled
2430 static void __Pyx_init_assertions_enabled(
void) {
2431 __pyx_assertions_enabled_flag = ! _PyInterpreterState_GetConfig(__Pyx_PyThreadState_Current->interp)->optimization_level;
2434 #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
2438 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
2441 static CYTHON_INLINE
int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq,
int eq) {
2442 int result = PySequence_Contains(seq, item);
2443 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
2447 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2450 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
2453 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2454 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2456 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2460 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2461 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2463 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2467 static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
2470 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2473 static int __Pyx_setup_reduce(PyObject* type_obj);
2476 #ifndef __PYX_HAVE_RT_ImportType_proto_0_29_36
2477 #define __PYX_HAVE_RT_ImportType_proto_0_29_36
2478 #if __STDC_VERSION__ >= 201112L
2479 #include <stdalign.h>
2481 #if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
2482 #define __PYX_GET_STRUCT_ALIGNMENT_0_29_36(s) alignof(s)
2484 #define __PYX_GET_STRUCT_ALIGNMENT_0_29_36(s) sizeof(void*)
2486 enum __Pyx_ImportType_CheckSize_0_29_36 {
2487 __Pyx_ImportType_CheckSize_Error_0_29_36 = 0,
2488 __Pyx_ImportType_CheckSize_Warn_0_29_36 = 1,
2489 __Pyx_ImportType_CheckSize_Ignore_0_29_36 = 2
2491 static PyTypeObject *__Pyx_ImportType_0_29_36(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
size_t alignment,
enum __Pyx_ImportType_CheckSize_0_29_36 check_size);
2495 static void* __Pyx_GetVtable(PyObject *dict);
2498 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2501 #define __Pyx_CyFunction_USED 1
2502 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2503 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2504 #define __Pyx_CYFUNCTION_CCLASS 0x04
2505 #define __Pyx_CyFunction_GetClosure(f)\
2506 (((__pyx_CyFunctionObject *) (f))->func_closure)
2507 #define __Pyx_CyFunction_GetClassObj(f)\
2508 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2509 #define __Pyx_CyFunction_Defaults(type, f)\
2510 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2511 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2512 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2514 PyCFunctionObject func;
2515 #if PY_VERSION_HEX < 0x030500A0
2516 PyObject *func_weakreflist;
2518 PyObject *func_dict;
2519 PyObject *func_name;
2520 PyObject *func_qualname;
2522 PyObject *func_globals;
2523 PyObject *func_code;
2524 PyObject *func_closure;
2525 PyObject *func_classobj;
2527 int defaults_pyobjects;
2528 size_t defaults_size;
2530 PyObject *defaults_tuple;
2531 PyObject *defaults_kwdict;
2532 PyObject *(*defaults_getter)(PyObject *);
2533 PyObject *func_annotations;
2534 } __pyx_CyFunctionObject;
2535 static PyTypeObject *__pyx_CyFunctionType = 0;
2536 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
2537 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2538 int flags, PyObject* qualname,
2540 PyObject *module, PyObject *globals,
2542 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2545 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2547 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2549 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2551 static int __pyx_CyFunction_init(
void);
2554 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2555 int flags, PyObject* qualname,
2557 PyObject *module, PyObject *globals,
2561 #ifdef CYTHON_CLINE_IN_TRACEBACK
2562 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2564 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
2569 PyCodeObject* code_object;
2571 } __Pyx_CodeObjectCacheEntry;
2572 struct __Pyx_CodeObjectCache {
2575 __Pyx_CodeObjectCacheEntry* entries;
2577 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2578 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
2579 static PyCodeObject *__pyx_find_code_object(
int code_line);
2580 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
2583 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
2584 int py_line,
const char *filename);
2586 #if PY_MAJOR_VERSION < 3
2587 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
2588 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2590 #define __Pyx_GetBuffer PyObject_GetBuffer
2591 #define __Pyx_ReleaseBuffer PyBuffer_Release
2597 Py_ssize_t shape, strides, suboffsets;
2598 } __Pyx_Buf_DimInfo;
2604 __Pyx_Buffer *rcbuffer;
2606 __Pyx_Buf_DimInfo diminfo[8];
2607 } __Pyx_LocalBuf_ND;
2610 static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
2613 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2614 __Pyx_memviewslice *slice2,
2615 int ndim,
size_t itemsize);
2618 static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2621 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2622 #define __Pyx_HAS_GCC_DIAGNOSTIC
2626 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void);
2629 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts);
2630 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2631 __Pyx_BufFmt_StackElem* stack,
2632 __Pyx_TypeInfo* type);
2635 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2638 static int __Pyx_ValidateAndInit_memviewslice(
2643 __Pyx_TypeInfo *dtype,
2644 __Pyx_BufFmt_StackElem stack[],
2645 __Pyx_memviewslice *memviewslice,
2646 PyObject *original_obj);
2649 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *,
int writable_flag);
2652 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *,
int writable_flag);
2655 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *,
int writable_flag);
2658 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *,
int writable_flag);
2661 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *,
int writable_flag);
2664 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(PyObject *,
int writable_flag);
2667 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_long__double(PyObject *,
int writable_flag);
2672 #define __Pyx_CREAL(z) ((z).real())
2673 #define __Pyx_CIMAG(z) ((z).imag())
2675 #define __Pyx_CREAL(z) (__real__(z))
2676 #define __Pyx_CIMAG(z) (__imag__(z))
2679 #define __Pyx_CREAL(z) ((z).real)
2680 #define __Pyx_CIMAG(z) ((z).imag)
2682 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2683 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2684 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2685 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2687 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2688 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2693 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2694 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2695 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2696 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2697 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2698 #define __Pyx_c_neg_float(a) (-(a))
2700 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2701 #define __Pyx_c_conj_float(z) (::std::conj(z))
2703 #define __Pyx_c_abs_float(z) (::std::abs(z))
2704 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2707 #define __Pyx_c_is_zero_float(z) ((z)==0)
2708 #define __Pyx_c_conj_float(z) (conjf(z))
2710 #define __Pyx_c_abs_float(z) (cabsf(z))
2711 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2715 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2716 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2717 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2718 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2719 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2720 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2721 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2722 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2724 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
2725 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2731 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2732 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2733 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2734 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2735 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2736 #define __Pyx_c_neg_double(a) (-(a))
2738 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2739 #define __Pyx_c_conj_double(z) (::std::conj(z))
2741 #define __Pyx_c_abs_double(z) (::std::abs(z))
2742 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2745 #define __Pyx_c_is_zero_double(z) ((z)==0)
2746 #define __Pyx_c_conj_double(z) (conj(z))
2748 #define __Pyx_c_abs_double(z) (cabs(z))
2749 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2753 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2754 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2755 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2756 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2757 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2758 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2759 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2760 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2762 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
2763 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2768 static __Pyx_memviewslice
2769 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2770 const char *mode,
int ndim,
2771 size_t sizeof_dtype,
int contig_flag,
2772 int dtype_is_object);
2775 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2778 static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *);
2781 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2784 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2787 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2790 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2793 static int __Pyx_check_binary_version(
void);
2796 static int __Pyx_ExportFunction(
const char *name,
void (*f)(
void),
const char *sig);
2799 static int __Pyx_ImportFunction_0_29_36(PyObject *module,
const char *funcname,
void (**f)(
void),
const char *sig);
2802 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2804 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2805 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2806 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2807 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2808 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value);
2809 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2810 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2811 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2812 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2813 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2818 static PyTypeObject *__pyx_ptype_5imate_9functions_12py_functions_pyFunction = 0;
2827 static PyTypeObject *__pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator = 0;
2830 static PyTypeObject *__pyx_ptype_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix = 0;
2833 static PyTypeObject *__pyx_ptype_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction = 0;
2848 static void (*__pyx_f_5scipy_6linalg_13cython_lapack_dbdsdc)(
char *,
char *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *,
int *);
2849 static void (*__pyx_f_5scipy_6linalg_13cython_lapack_dstev)(
char *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *);
2850 static void (*__pyx_f_5scipy_6linalg_13cython_lapack_sbdsdc)(
char *,
char *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *,
int *);
2851 static void (*__pyx_f_5scipy_6linalg_13cython_lapack_sstev)(
char *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *);
2854 static PyTypeObject *__pyx_array_type = 0;
2855 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2856 static PyTypeObject *__pyx_memoryview_type = 0;
2857 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2858 static PyObject *
generic = 0;
2859 static PyObject *strided = 0;
2860 static PyObject *indirect = 0;
2861 static PyObject *contiguous = 0;
2862 static PyObject *indirect_contiguous = 0;
2863 static int __pyx_memoryview_thread_locks_used;
2864 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2865 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, PyObject *,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *,
int __pyx_skip_dispatch);
2868 __PYX_EXTERN_C void lapack_sbdsdc(
char *,
char *,
int *,
float *,
float *,
float *,
int *,
float *,
int *,
float *,
int *,
float *,
int *,
int *);
2869 __PYX_EXTERN_C void lapack_dbdsdc(
char *,
char *,
int *,
double *,
double *,
double *,
int *,
double *,
int *,
double *,
int *,
double *,
int *,
int *);
2870 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_float(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, __pyx_t_5imate_12_definitions_5types_IndexType
const ,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *, __pyx_t_5imate_12_definitions_5types_FlagType
const ,
float const , __pyx_t_5imate_12_definitions_5types_FlagType
const , int64_t
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
float const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
float const ,
float const ,
float const ,
float const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType,
float &);
2871 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_double(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, __pyx_t_5imate_12_definitions_5types_IndexType
const ,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *, __pyx_t_5imate_12_definitions_5types_FlagType
const ,
double const , __pyx_t_5imate_12_definitions_5types_FlagType
const , int64_t
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
double const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
double const ,
double const ,
double const ,
double const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType,
float &);
2872 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_long_double(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, __pyx_t_5imate_12_definitions_5types_IndexType
const ,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *, __pyx_t_5imate_12_definitions_5types_FlagType
const ,
long double const , __pyx_t_5imate_12_definitions_5types_FlagType
const , int64_t
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
long double const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
long double const ,
long double const ,
long double const ,
long double const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType,
float &);
2873 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2874 static void *__pyx_align_pointer(
void *,
size_t);
2875 static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2876 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2877 static PyObject *_unellipsify(PyObject *,
int);
2878 static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2879 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2880 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int,
int);
2881 static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2882 static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2883 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2884 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2885 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2886 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2887 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2888 static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2889 static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2890 static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2891 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2892 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2893 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2894 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2895 static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2896 static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2897 static int __pyx_memoryview_err(PyObject *,
char *);
2898 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2899 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2900 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2901 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2902 static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2903 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2904 static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2905 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2906 static __Pyx_TypeInfo __Pyx_TypeInfo_float = {
"float", NULL,
sizeof(float), { 0 }, 0,
'R', 0, 0 };
2907 static __Pyx_TypeInfo __Pyx_TypeInfo_int = {
"int", NULL,
sizeof(int), { 0 }, 0, IS_UNSIGNED(
int) ?
'U' :
'I', IS_UNSIGNED(
int), 0 };
2908 static __Pyx_TypeInfo __Pyx_TypeInfo_double = {
"double", NULL,
sizeof(double), { 0 }, 0,
'R', 0, 0 };
2909 static __Pyx_TypeInfo __Pyx_TypeInfo_long__double = {
"long double", NULL,
sizeof(
long double), { 0 }, 0,
'R', 0, 0 };
2910 #define __Pyx_MODULE_NAME "imate._c_trace_estimator.py_c_trace_estimator"
2911 extern int __pyx_module_is_main_imate___c_trace_estimator__py_c_trace_estimator;
2912 int __pyx_module_is_main_imate___c_trace_estimator__py_c_trace_estimator = 0;
2915 static PyObject *__pyx_builtin_TypeError;
2916 static PyObject *__pyx_builtin_range;
2917 static PyObject *__pyx_builtin_ValueError;
2918 static PyObject *__pyx_builtin_MemoryError;
2919 static PyObject *__pyx_builtin_enumerate;
2920 static PyObject *__pyx_builtin_Ellipsis;
2921 static PyObject *__pyx_builtin_id;
2922 static PyObject *__pyx_builtin_IndexError;
2923 static const char __pyx_k_O[] =
"O";
2924 static const char __pyx_k_c[] =
"c";
2925 static const char __pyx_k_id[] =
"id";
2926 static const char __pyx_k_Aop[] =
"Aop";
2927 static const char __pyx_k_new[] =
"__new__";
2928 static const char __pyx_k_obj[] =
"obj";
2929 static const char __pyx_k_base[] =
"base";
2930 static const char __pyx_k_dict[] =
"__dict__";
2931 static const char __pyx_k_gram[] =
"gram";
2932 static const char __pyx_k_main[] =
"__main__";
2933 static const char __pyx_k_mode[] =
"mode";
2934 static const char __pyx_k_name[] =
"name";
2935 static const char __pyx_k_ndim[] =
"ndim";
2936 static const char __pyx_k_pack[] =
"pack";
2937 static const char __pyx_k_seed[] =
"seed";
2938 static const char __pyx_k_size[] =
"size";
2939 static const char __pyx_k_step[] =
"step";
2940 static const char __pyx_k_stop[] =
"stop";
2941 static const char __pyx_k_test[] =
"__test__";
2942 static const char __pyx_k_ASCII[] =
"ASCII";
2943 static const char __pyx_k_class[] =
"__class__";
2944 static const char __pyx_k_error[] =
"error";
2945 static const char __pyx_k_flags[] =
"flags";
2946 static const char __pyx_k_numpy[] =
"numpy";
2947 static const char __pyx_k_range[] =
"range";
2948 static const char __pyx_k_shape[] =
"shape";
2949 static const char __pyx_k_start[] =
"start";
2950 static const char __pyx_k_trace[] =
"trace";
2951 static const char __pyx_k_encode[] =
"encode";
2952 static const char __pyx_k_format[] =
"format";
2953 static const char __pyx_k_import[] =
"__import__";
2954 static const char __pyx_k_name_2[] =
"__name__";
2955 static const char __pyx_k_pickle[] =
"pickle";
2956 static const char __pyx_k_reduce[] =
"__reduce__";
2957 static const char __pyx_k_struct[] =
"struct";
2958 static const char __pyx_k_unpack[] =
"unpack";
2959 static const char __pyx_k_update[] =
"update";
2960 static const char __pyx_k_float32[] =
"float32";
2961 static const char __pyx_k_float64[] =
"float64";
2962 static const char __pyx_k_fortran[] =
"fortran";
2963 static const char __pyx_k_memview[] =
"memview";
2964 static const char __pyx_k_samples[] =
"samples";
2965 static const char __pyx_k_Ellipsis[] =
"Ellipsis";
2966 static const char __pyx_k_exponent[] =
"exponent";
2967 static const char __pyx_k_float128[] =
"float128";
2968 static const char __pyx_k_getstate[] =
"__getstate__";
2969 static const char __pyx_k_isscalar[] =
"isscalar";
2970 static const char __pyx_k_itemsize[] =
"itemsize";
2971 static const char __pyx_k_pyx_type[] =
"__pyx_type";
2972 static const char __pyx_k_setstate[] =
"__setstate__";
2973 static const char __pyx_k_TypeError[] =
"TypeError";
2974 static const char __pyx_k_converged[] =
"converged";
2975 static const char __pyx_k_enumerate[] =
"enumerate";
2976 static const char __pyx_k_pyx_state[] =
"__pyx_state";
2977 static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
2978 static const char __pyx_k_IndexError[] =
"IndexError";
2979 static const char __pyx_k_ValueError[] =
"ValueError";
2980 static const char __pyx_k_error_atol[] =
"error_atol";
2981 static const char __pyx_k_error_rtol[] =
"error_rtol";
2982 static const char __pyx_k_parameters[] =
"parameters";
2983 static const char __pyx_k_pyx_result[] =
"__pyx_result";
2984 static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
2985 static const char __pyx_k_MemoryError[] =
"MemoryError";
2986 static const char __pyx_k_PickleError[] =
"PickleError";
2987 static const char __pyx_k_lanczos_tol[] =
"lanczos_tol";
2988 static const char __pyx_k_num_threads[] =
"num_threads";
2989 static const char __pyx_k_num_outliers[] =
"num_outliers";
2990 static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
2991 static const char __pyx_k_stringsource[] =
"stringsource";
2992 static const char __pyx_k_num_inquiries[] =
"num_inquiries";
2993 static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
2994 static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
2995 static const char __pyx_k_alg_wall_times[] =
"alg_wall_times";
2996 static const char __pyx_k_data_type_name[] =
"data_type_name";
2997 static const char __pyx_k_lanczos_degree[] =
"lanczos_degree";
2998 static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
2999 static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
3000 static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
3001 static const char __pyx_k_max_num_samples[] =
"max_num_samples";
3002 static const char __pyx_k_min_num_samples[] =
"min_num_samples";
3003 static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
3004 static const char __pyx_k_reorthogonalize[] =
"reorthogonalize";
3005 static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
3006 static const char __pyx_k_confidence_level[] =
"confidence_level";
3007 static const char __pyx_k_num_samples_used[] =
"num_samples_used";
3008 static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
3009 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
3010 static const char __pyx_k_py_matrix_function[] =
"py_matrix_function";
3011 static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
3012 static const char __pyx_k_pyc_trace_estimator[] =
"pyc_trace_estimator";
3013 static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
3014 static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
3015 static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
3016 static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
3017 static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
3018 static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
3019 static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
3020 static const char __pyx_k_processed_samples_indices[] =
"processed_samples_indices";
3021 static const char __pyx_k_outlier_significance_level[] =
"outlier_significance_level";
3022 static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
3023 static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
3024 static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
3025 static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
3026 static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
3027 static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
3028 static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
3029 static const char __pyx_k_Data_type_should_be_float32_floa[] =
"Data type should be \"float32\", \"float64\", or \"float128\".";
3030 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
3031 static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] =
"Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))";
3032 static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
3033 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
3034 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
3035 static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
3036 static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
3037 static const char __pyx_k_imate__c_trace_estimator_py_c_tr[] =
"imate/_c_trace_estimator/py_c_trace_estimator.pyx";
3038 static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
3039 static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
3040 static const char __pyx_k_imate__c_trace_estimator_py_c_tr_2[] =
"imate._c_trace_estimator.py_c_trace_estimator";
3041 static PyObject *__pyx_n_s_ASCII;
3042 static PyObject *__pyx_n_s_Aop;
3043 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
3044 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
3045 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
3046 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
3047 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
3048 static PyObject *__pyx_kp_u_Data_type_should_be_float32_floa;
3049 static PyObject *__pyx_n_s_Ellipsis;
3050 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
3051 static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
3052 static PyObject *__pyx_n_s_IndexError;
3053 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
3054 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
3055 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
3056 static PyObject *__pyx_n_s_MemoryError;
3057 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
3058 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
3059 static PyObject *__pyx_n_b_O;
3060 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
3061 static PyObject *__pyx_n_s_PickleError;
3062 static PyObject *__pyx_n_s_TypeError;
3063 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
3064 static PyObject *__pyx_n_s_ValueError;
3065 static PyObject *__pyx_n_s_View_MemoryView;
3066 static PyObject *__pyx_n_s_alg_wall_times;
3067 static PyObject *__pyx_n_s_allocate_buffer;
3068 static PyObject *__pyx_n_s_base;
3069 static PyObject *__pyx_n_s_c;
3070 static PyObject *__pyx_n_u_c;
3071 static PyObject *__pyx_n_s_class;
3072 static PyObject *__pyx_n_s_cline_in_traceback;
3073 static PyObject *__pyx_n_s_confidence_level;
3074 static PyObject *__pyx_kp_s_contiguous_and_direct;
3075 static PyObject *__pyx_kp_s_contiguous_and_indirect;
3076 static PyObject *__pyx_n_s_converged;
3077 static PyObject *__pyx_n_s_data_type_name;
3078 static PyObject *__pyx_n_s_dict;
3079 static PyObject *__pyx_n_s_dtype_is_object;
3080 static PyObject *__pyx_n_s_encode;
3081 static PyObject *__pyx_n_s_enumerate;
3082 static PyObject *__pyx_n_s_error;
3083 static PyObject *__pyx_n_s_error_atol;
3084 static PyObject *__pyx_n_s_error_rtol;
3085 static PyObject *__pyx_n_s_exponent;
3086 static PyObject *__pyx_n_s_flags;
3087 static PyObject *__pyx_n_b_float128;
3088 static PyObject *__pyx_n_b_float32;
3089 static PyObject *__pyx_n_b_float64;
3090 static PyObject *__pyx_n_s_format;
3091 static PyObject *__pyx_n_s_fortran;
3092 static PyObject *__pyx_n_u_fortran;
3093 static PyObject *__pyx_n_s_getstate;
3094 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
3095 static PyObject *__pyx_n_s_gram;
3096 static PyObject *__pyx_n_s_id;
3097 static PyObject *__pyx_kp_s_imate__c_trace_estimator_py_c_tr;
3098 static PyObject *__pyx_n_s_imate__c_trace_estimator_py_c_tr_2;
3099 static PyObject *__pyx_n_s_import;
3100 static PyObject *__pyx_n_s_isscalar;
3101 static PyObject *__pyx_n_s_itemsize;
3102 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
3103 static PyObject *__pyx_n_s_lanczos_degree;
3104 static PyObject *__pyx_n_s_lanczos_tol;
3105 static PyObject *__pyx_n_s_main;
3106 static PyObject *__pyx_n_s_max_num_samples;
3107 static PyObject *__pyx_n_s_memview;
3108 static PyObject *__pyx_n_s_min_num_samples;
3109 static PyObject *__pyx_n_s_mode;
3110 static PyObject *__pyx_n_s_name;
3111 static PyObject *__pyx_n_s_name_2;
3112 static PyObject *__pyx_n_s_ndim;
3113 static PyObject *__pyx_n_s_new;
3114 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
3115 static PyObject *__pyx_n_s_num_inquiries;
3116 static PyObject *__pyx_n_s_num_outliers;
3117 static PyObject *__pyx_n_s_num_samples_used;
3118 static PyObject *__pyx_n_s_num_threads;
3119 static PyObject *__pyx_n_s_numpy;
3120 static PyObject *__pyx_n_s_obj;
3121 static PyObject *__pyx_n_s_outlier_significance_level;
3122 static PyObject *__pyx_n_s_pack;
3123 static PyObject *__pyx_n_s_parameters;
3124 static PyObject *__pyx_n_s_pickle;
3125 static PyObject *__pyx_n_s_processed_samples_indices;
3126 static PyObject *__pyx_n_s_py_matrix_function;
3127 static PyObject *__pyx_n_s_pyc_trace_estimator;
3128 static PyObject *__pyx_n_s_pyx_PickleError;
3129 static PyObject *__pyx_n_s_pyx_checksum;
3130 static PyObject *__pyx_n_s_pyx_getbuffer;
3131 static PyObject *__pyx_n_s_pyx_result;
3132 static PyObject *__pyx_n_s_pyx_state;
3133 static PyObject *__pyx_n_s_pyx_type;
3134 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
3135 static PyObject *__pyx_n_s_pyx_vtable;
3136 static PyObject *__pyx_n_s_range;
3137 static PyObject *__pyx_n_s_reduce;
3138 static PyObject *__pyx_n_s_reduce_cython;
3139 static PyObject *__pyx_n_s_reduce_ex;
3140 static PyObject *__pyx_n_s_reorthogonalize;
3141 static PyObject *__pyx_n_s_samples;
3142 static PyObject *__pyx_n_s_seed;
3143 static PyObject *__pyx_n_s_setstate;
3144 static PyObject *__pyx_n_s_setstate_cython;
3145 static PyObject *__pyx_n_s_shape;
3146 static PyObject *__pyx_n_s_size;
3147 static PyObject *__pyx_n_s_start;
3148 static PyObject *__pyx_n_s_step;
3149 static PyObject *__pyx_n_s_stop;
3150 static PyObject *__pyx_kp_s_strided_and_direct;
3151 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
3152 static PyObject *__pyx_kp_s_strided_and_indirect;
3153 static PyObject *__pyx_kp_s_stringsource;
3154 static PyObject *__pyx_n_s_struct;
3155 static PyObject *__pyx_n_s_test;
3156 static PyObject *__pyx_n_s_trace;
3157 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
3158 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
3159 static PyObject *__pyx_n_s_unpack;
3160 static PyObject *__pyx_n_s_update;
3161 static PyObject *__pyx_pf_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(CYTHON_UNUSED PyObject *__pyx_self,
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, PyObject *__pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, PyObject *__pyx_v_gram, PyObject *__pyx_v_exponent, PyObject *__pyx_v_reorthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_lanczos_degree, PyObject *__pyx_v_lanczos_tol, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_data_type_name, PyObject *__pyx_v_trace, PyObject *__pyx_v_error, PyObject *__pyx_v_samples, PyObject *__pyx_v_processed_samples_indices, PyObject *__pyx_v_num_samples_used, PyObject *__pyx_v_num_outliers, PyObject *__pyx_v_converged, PyObject *__pyx_v_alg_wall_times);
3162 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer);
3163 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
3164 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
3165 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
3166 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
3167 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
3168 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
3169 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
3170 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
3171 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
3172 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
3173 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
3174 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
3175 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
3176 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object);
3177 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
3178 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
3179 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
3180 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
3181 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3182 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3183 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3184 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3185 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3186 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3187 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3188 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3189 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3190 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
3191 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
3192 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
3193 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
3194 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
3195 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
3196 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
3197 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
3198 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
3199 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
3200 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
3201 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
3202 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
3203 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state);
3204 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
3205 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
3206 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
3207 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
3208 static PyObject *__pyx_int_0;
3209 static PyObject *__pyx_int_1;
3210 static PyObject *__pyx_int_112105877;
3211 static PyObject *__pyx_int_136983863;
3212 static PyObject *__pyx_int_184977713;
3213 static PyObject *__pyx_int_neg_1;
3214 static PyObject *__pyx_codeobj_;
3215 static PyObject *__pyx_tuple__2;
3216 static PyObject *__pyx_tuple__3;
3217 static PyObject *__pyx_tuple__4;
3218 static PyObject *__pyx_tuple__5;
3219 static PyObject *__pyx_tuple__6;
3220 static PyObject *__pyx_tuple__7;
3221 static PyObject *__pyx_tuple__8;
3222 static PyObject *__pyx_tuple__9;
3223 static PyObject *__pyx_slice__17;
3224 static PyObject *__pyx_tuple__10;
3225 static PyObject *__pyx_tuple__11;
3226 static PyObject *__pyx_tuple__12;
3227 static PyObject *__pyx_tuple__13;
3228 static PyObject *__pyx_tuple__14;
3229 static PyObject *__pyx_tuple__15;
3230 static PyObject *__pyx_tuple__16;
3231 static PyObject *__pyx_tuple__18;
3232 static PyObject *__pyx_tuple__19;
3233 static PyObject *__pyx_tuple__20;
3234 static PyObject *__pyx_tuple__22;
3235 static PyObject *__pyx_tuple__23;
3236 static PyObject *__pyx_tuple__24;
3237 static PyObject *__pyx_tuple__25;
3238 static PyObject *__pyx_tuple__26;
3239 static PyObject *__pyx_tuple__27;
3240 static PyObject *__pyx_tuple__28;
3241 static PyObject *__pyx_tuple__29;
3242 static PyObject *__pyx_codeobj__21;
3253 void lapack_sstev(
char *__pyx_v_jobz,
int *__pyx_v_n,
float *__pyx_v_d,
float *__pyx_v_e,
float *__pyx_v_z,
int *__pyx_v_ldz,
float *__pyx_v_work,
int *__pyx_v_info) {
3254 __Pyx_TraceDeclarations
3255 int __pyx_lineno = 0;
3256 const char *__pyx_filename = NULL;
3257 int __pyx_clineno = 0;
3258 __Pyx_TraceCall(
"lapack_sstev", __pyx_f[1], 21, 1, __PYX_ERR(1, 21, __pyx_L1_error));
3267 __Pyx_TraceLine(34,1,__PYX_ERR(1, 34, __pyx_L1_error))
3268 __pyx_f_5scipy_6linalg_13cython_lapack_sstev(__pyx_v_jobz, __pyx_v_n, __pyx_v_d, __pyx_v_e, __pyx_v_z, __pyx_v_ldz, __pyx_v_work, __pyx_v_info);
3281 __Pyx_WriteUnraisable(
"imate._c_trace_estimator.py_c_trace_estimator.lapack_sstev", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
3283 __Pyx_TraceReturn(Py_None, 1);
3294 void lapack_dstev(
char *__pyx_v_jobz,
int *__pyx_v_n,
double *__pyx_v_d,
double *__pyx_v_e,
double *__pyx_v_z,
int *__pyx_v_ldz,
double *__pyx_v_work,
int *__pyx_v_info) {
3295 __Pyx_TraceDeclarations
3296 int __pyx_lineno = 0;
3297 const char *__pyx_filename = NULL;
3298 int __pyx_clineno = 0;
3299 __Pyx_TraceCall(
"lapack_dstev", __pyx_f[1], 41, 1, __PYX_ERR(1, 41, __pyx_L1_error));
3308 __Pyx_TraceLine(55,1,__PYX_ERR(1, 55, __pyx_L1_error))
3309 __pyx_f_5scipy_6linalg_13cython_lapack_dstev(__pyx_v_jobz, __pyx_v_n, __pyx_v_d, __pyx_v_e, __pyx_v_z, __pyx_v_ldz, __pyx_v_work, __pyx_v_info);
3322 __Pyx_WriteUnraisable(
"imate._c_trace_estimator.py_c_trace_estimator.lapack_dstev", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
3324 __Pyx_TraceReturn(Py_None, 1);
3335 void lapack_sbdsdc(
char *__pyx_v_uplo,
char *__pyx_v_compq,
int *__pyx_v_n,
float *__pyx_v_d,
float *__pyx_v_e,
float *__pyx_v_u,
int *__pyx_v_ldu,
float *__pyx_v_vt,
int *__pyx_v_ldvt,
float *__pyx_v_q,
int *__pyx_v_iq,
float *__pyx_v_work,
int *__pyx_v_iwork,
int *__pyx_v_info) {
3336 __Pyx_TraceDeclarations
3337 int __pyx_lineno = 0;
3338 const char *__pyx_filename = NULL;
3339 int __pyx_clineno = 0;
3340 __Pyx_TraceCall(
"lapack_sbdsdc", __pyx_f[1], 62, 1, __PYX_ERR(1, 62, __pyx_L1_error));
3349 __Pyx_TraceLine(77,1,__PYX_ERR(1, 77, __pyx_L1_error))
3350 __pyx_f_5scipy_6linalg_13cython_lapack_sbdsdc(__pyx_v_uplo, __pyx_v_compq, __pyx_v_n, __pyx_v_d, __pyx_v_e, __pyx_v_u, __pyx_v_ldu, __pyx_v_vt, __pyx_v_ldvt, __pyx_v_q, __pyx_v_iq, __pyx_v_work, __pyx_v_iwork, __pyx_v_info);
3363 __Pyx_WriteUnraisable(
"imate._c_trace_estimator.py_c_trace_estimator.lapack_sbdsdc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
3365 __Pyx_TraceReturn(Py_None, 1);
3376 void lapack_dbdsdc(
char *__pyx_v_uplo,
char *__pyx_v_compq,
int *__pyx_v_n,
double *__pyx_v_d,
double *__pyx_v_e,
double *__pyx_v_u,
int *__pyx_v_ldu,
double *__pyx_v_vt,
int *__pyx_v_ldvt,
double *__pyx_v_q,
int *__pyx_v_iq,
double *__pyx_v_work,
int *__pyx_v_iwork,
int *__pyx_v_info) {
3377 __Pyx_TraceDeclarations
3378 int __pyx_lineno = 0;
3379 const char *__pyx_filename = NULL;
3380 int __pyx_clineno = 0;
3381 __Pyx_TraceCall(
"lapack_dbdsdc", __pyx_f[1], 84, 1, __PYX_ERR(1, 84, __pyx_L1_error));
3388 __Pyx_TraceLine(99,1,__PYX_ERR(1, 99, __pyx_L1_error))
3389 __pyx_f_5scipy_6linalg_13cython_lapack_dbdsdc(__pyx_v_uplo, __pyx_v_compq, __pyx_v_n, __pyx_v_d, __pyx_v_e, __pyx_v_u, __pyx_v_ldu, __pyx_v_vt, __pyx_v_ldvt, __pyx_v_q, __pyx_v_iq, __pyx_v_work, __pyx_v_iwork, __pyx_v_info);
3402 __Pyx_WriteUnraisable(
"imate._c_trace_estimator.py_c_trace_estimator.lapack_dbdsdc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
3404 __Pyx_TraceReturn(Py_None, 1);
3415 static PyObject *__pyx_pw_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3416 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, PyObject *__pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, PyObject *__pyx_v_gram, PyObject *__pyx_v_exponent, PyObject *__pyx_v_reorthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_lanczos_degree, PyObject *__pyx_v_lanczos_tol, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_data_type_name, PyObject *__pyx_v_trace, PyObject *__pyx_v_error, PyObject *__pyx_v_samples, PyObject *__pyx_v_processed_samples_indices, PyObject *__pyx_v_num_samples_used, PyObject *__pyx_v_num_outliers, PyObject *__pyx_v_converged, PyObject *__pyx_v_alg_wall_times, CYTHON_UNUSED
int __pyx_skip_dispatch) {
3417 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_v_all_converged;
3418 float __pyx_v_alg_wall_time;
3419 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_r;
3420 __Pyx_TraceDeclarations
3421 __Pyx_RefNannyDeclarations
3423 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_2;
3424 PyObject *__pyx_t_3 = NULL;
3425 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_t_4;
3427 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_t_6;
3429 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_8;
3431 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
3432 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
3437 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_16;
3438 __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
3439 __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
3440 __Pyx_memviewslice __pyx_t_19 = { 0, 0, { 0 }, { 0 }, { 0 } };
3441 __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } };
3442 __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_t_21 = { 0, 0, { 0 }, { 0 }, { 0 } };
3443 __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_t_22 = { 0, 0, { 0 }, { 0 }, { 0 } };
3444 __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType __pyx_t_23 = { 0, 0, { 0 }, { 0 }, { 0 } };
3445 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_t_24;
3452 __Pyx_memviewslice __pyx_t_31 = { 0, 0, { 0 }, { 0 }, { 0 } };
3453 __Pyx_memviewslice __pyx_t_32 = { 0, 0, { 0 }, { 0 }, { 0 } };
3454 __Pyx_memviewslice __pyx_t_33 = { 0, 0, { 0 }, { 0 }, { 0 } };
3455 long double __pyx_t_34;
3456 long double __pyx_t_35;
3457 long double __pyx_t_36;
3458 long double __pyx_t_37;
3459 long double __pyx_t_38;
3460 long double __pyx_t_39;
3461 __Pyx_memviewslice __pyx_t_40 = { 0, 0, { 0 }, { 0 }, { 0 } };
3462 __Pyx_memviewslice __pyx_t_41 = { 0, 0, { 0 }, { 0 }, { 0 } };
3463 __Pyx_memviewslice __pyx_t_42 = { 0, 0, { 0 }, { 0 }, { 0 } };
3464 int __pyx_lineno = 0;
3465 const char *__pyx_filename = NULL;
3466 int __pyx_clineno = 0;
3467 __Pyx_TraceFrameInit(__pyx_codeobj_)
3468 __Pyx_RefNannySetupContext(
"pyc_trace_estimator", 0);
3469 __Pyx_TraceCall(
"pyc_trace_estimator", __pyx_f[0], 39, 0, __PYX_ERR(0, 39, __pyx_L1_error));
3478 __Pyx_TraceLine(69,0,__PYX_ERR(0, 69, __pyx_L1_error))
3479 __pyx_v_all_converged = 0;
3488 __Pyx_TraceLine(70,0,__PYX_ERR(0, 70, __pyx_L1_error))
3489 __pyx_v_alg_wall_time = 0.0;
3498 __Pyx_TraceLine(72,0,__PYX_ERR(0, 72, __pyx_L1_error))
3499 __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float32, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 72, __pyx_L1_error)
3509 __Pyx_TraceLine(77,0,__PYX_ERR(0, 77, __pyx_L1_error))
3510 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_num_inquiries);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error)
3519 __Pyx_TraceLine(79,0,__PYX_ERR(0, 79, __pyx_L1_error))
3520 __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_gram);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
3521 __Pyx_GOTREF(__pyx_t_3);
3522 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
3523 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3532 __Pyx_TraceLine(80,0,__PYX_ERR(0, 80, __pyx_L1_error))
3533 __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_exponent);
if (unlikely((__pyx_t_5 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error)
3542 __Pyx_TraceLine(81,0,__PYX_ERR(0, 81, __pyx_L1_error))
3543 __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_reorthogonalize);
if (unlikely((__pyx_t_6 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error)
3552 __Pyx_TraceLine(82,0,__PYX_ERR(0, 82, __pyx_L1_error))
3553 __pyx_t_7 = __Pyx_PyInt_As_int64_t(__pyx_v_seed);
if (unlikely((__pyx_t_7 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
3562 __Pyx_TraceLine(83,0,__PYX_ERR(0, 83, __pyx_L1_error))
3563 __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_lanczos_degree);
if (unlikely((__pyx_t_8 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error)
3572 __Pyx_TraceLine(84,0,__PYX_ERR(0, 84, __pyx_L1_error))
3573 __pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_v_lanczos_tol);
if (unlikely((__pyx_t_9 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error)
3582 __Pyx_TraceLine(85,0,__PYX_ERR(0, 85, __pyx_L1_error))
3583 __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_min_num_samples);
if (unlikely((__pyx_t_10 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
3592 __Pyx_TraceLine(86,0,__PYX_ERR(0, 86, __pyx_L1_error))
3593 __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples);
if (unlikely((__pyx_t_11 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
3602 __Pyx_TraceLine(87,0,__PYX_ERR(0, 87, __pyx_L1_error))
3603 __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_error_atol);
if (unlikely((__pyx_t_12 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error)
3612 __Pyx_TraceLine(88,0,__PYX_ERR(0, 88, __pyx_L1_error))
3613 __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_v_error_rtol);
if (unlikely((__pyx_t_13 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3622 __Pyx_TraceLine(89,0,__PYX_ERR(0, 89, __pyx_L1_error))
3623 __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_v_confidence_level);
if (unlikely((__pyx_t_14 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error)
3632 __Pyx_TraceLine(90,0,__PYX_ERR(0, 90, __pyx_L1_error))
3633 __pyx_t_15 = __pyx_PyFloat_AsFloat(__pyx_v_outlier_significance_level);
if (unlikely((__pyx_t_15 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error)
3642 __Pyx_TraceLine(91,0,__PYX_ERR(0, 91, __pyx_L1_error))
3643 __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_num_threads);
if (unlikely((__pyx_t_16 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error)
3652 __Pyx_TraceLine(92,0,__PYX_ERR(0, 92, __pyx_L1_error))
3653 __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_trace, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 92, __pyx_L1_error)
3662 __Pyx_TraceLine(93,0,__PYX_ERR(0, 93, __pyx_L1_error))
3663 __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_error, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 93, __pyx_L1_error)
3672 __Pyx_TraceLine(94,0,__PYX_ERR(0, 94, __pyx_L1_error))
3673 __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(__pyx_v_samples, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 94, __pyx_L1_error)
3682 __Pyx_TraceLine(95,0,__PYX_ERR(0, 95, __pyx_L1_error))
3683 __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_processed_samples_indices, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 95, __pyx_L1_error)
3692 __Pyx_TraceLine(96,0,__PYX_ERR(0, 96, __pyx_L1_error))
3693 __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_samples_used, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(0, 96, __pyx_L1_error)
3702 __Pyx_TraceLine(97,0,__PYX_ERR(0, 97, __pyx_L1_error))
3703 __pyx_t_22 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_outliers, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_22.memview)) __PYX_ERR(0, 97, __pyx_L1_error)
3712 __Pyx_TraceLine(98,0,__PYX_ERR(0, 98, __pyx_L1_error))
3713 __pyx_t_23 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_converged, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_23.memview)) __PYX_ERR(0, 98, __pyx_L1_error)
3722 __Pyx_TraceLine(74,0,__PYX_ERR(0, 74, __pyx_L1_error))
3723 __pyx_t_24 = __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_float(__pyx_v_Aop, __pyx_v_parameters, __pyx_t_2, __pyx_v_py_matrix_function, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_v_alg_wall_time);
if (unlikely(__pyx_t_24 == ((__pyx_t_5imate_12_definitions_5types_FlagType)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error)
3724 __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
3725 __pyx_t_17.memview = NULL;
3726 __pyx_t_17.data = NULL;
3727 __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
3728 __pyx_t_18.memview = NULL;
3729 __pyx_t_18.data = NULL;
3730 __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
3731 __pyx_t_19.memview = NULL;
3732 __pyx_t_19.data = NULL;
3733 __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
3734 __pyx_t_20.memview = NULL;
3735 __pyx_t_20.data = NULL;
3736 __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
3737 __pyx_t_21.memview = NULL;
3738 __pyx_t_21.data = NULL;
3739 __PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
3740 __pyx_t_22.memview = NULL;
3741 __pyx_t_22.data = NULL;
3742 __PYX_XDEC_MEMVIEW(&__pyx_t_23, 1);
3743 __pyx_t_23.memview = NULL;
3744 __pyx_t_23.data = NULL;
3745 __pyx_v_all_converged = __pyx_t_24;
3764 __Pyx_TraceLine(101,0,__PYX_ERR(0, 101, __pyx_L1_error))
3765 __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float64, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
3775 __Pyx_TraceLine(106,0,__PYX_ERR(0, 106, __pyx_L1_error))
3776 __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_num_inquiries);
if (unlikely((__pyx_t_16 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error)
3785 __Pyx_TraceLine(108,0,__PYX_ERR(0, 108, __pyx_L1_error))
3786 __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_gram);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
3787 __Pyx_GOTREF(__pyx_t_3);
3788 __pyx_t_24 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_24 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error)
3789 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3798 __Pyx_TraceLine(109,0,__PYX_ERR(0, 109, __pyx_L1_error))
3799 __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_v_exponent);
if (unlikely((__pyx_t_25 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L1_error)
3808 __Pyx_TraceLine(110,0,__PYX_ERR(0, 110, __pyx_L1_error))
3809 __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_reorthogonalize);
if (unlikely((__pyx_t_6 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error)
3818 __Pyx_TraceLine(111,0,__PYX_ERR(0, 111, __pyx_L1_error))
3819 __pyx_t_7 = __Pyx_PyInt_As_int64_t(__pyx_v_seed);
if (unlikely((__pyx_t_7 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error)
3828 __Pyx_TraceLine(112,0,__PYX_ERR(0, 112, __pyx_L1_error))
3829 __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_lanczos_degree);
if (unlikely((__pyx_t_11 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error)
3838 __Pyx_TraceLine(113,0,__PYX_ERR(0, 113, __pyx_L1_error))
3839 __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_lanczos_tol);
if (unlikely((__pyx_t_26 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L1_error)
3848 __Pyx_TraceLine(114,0,__PYX_ERR(0, 114, __pyx_L1_error))
3849 __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_min_num_samples);
if (unlikely((__pyx_t_10 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
3858 __Pyx_TraceLine(115,0,__PYX_ERR(0, 115, __pyx_L1_error))
3859 __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples);
if (unlikely((__pyx_t_8 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
3868 __Pyx_TraceLine(116,0,__PYX_ERR(0, 116, __pyx_L1_error))
3869 __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_v_error_atol);
if (unlikely((__pyx_t_27 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
3878 __Pyx_TraceLine(117,0,__PYX_ERR(0, 117, __pyx_L1_error))
3879 __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_v_error_rtol);
if (unlikely((__pyx_t_28 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L1_error)
3888 __Pyx_TraceLine(118,0,__PYX_ERR(0, 118, __pyx_L1_error))
3889 __pyx_t_29 = __pyx_PyFloat_AsDouble(__pyx_v_confidence_level);
if (unlikely((__pyx_t_29 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error)
3898 __Pyx_TraceLine(119,0,__PYX_ERR(0, 119, __pyx_L1_error))
3899 __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_v_outlier_significance_level);
if (unlikely((__pyx_t_30 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error)
3908 __Pyx_TraceLine(120,0,__PYX_ERR(0, 120, __pyx_L1_error))
3909 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_num_threads);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error)
3918 __Pyx_TraceLine(121,0,__PYX_ERR(0, 121, __pyx_L1_error))
3919 __pyx_t_31 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_trace, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_31.memview)) __PYX_ERR(0, 121, __pyx_L1_error)
3928 __Pyx_TraceLine(122,0,__PYX_ERR(0, 122, __pyx_L1_error))
3929 __pyx_t_32 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_error, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_32.memview)) __PYX_ERR(0, 122, __pyx_L1_error)
3938 __Pyx_TraceLine(123,0,__PYX_ERR(0, 123, __pyx_L1_error))
3939 __pyx_t_33 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_samples, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_33.memview)) __PYX_ERR(0, 123, __pyx_L1_error)
3948 __Pyx_TraceLine(124,0,__PYX_ERR(0, 124, __pyx_L1_error))
3949 __pyx_t_22 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_processed_samples_indices, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_22.memview)) __PYX_ERR(0, 124, __pyx_L1_error)
3958 __Pyx_TraceLine(125,0,__PYX_ERR(0, 125, __pyx_L1_error))
3959 __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_samples_used, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(0, 125, __pyx_L1_error)
3968 __Pyx_TraceLine(126,0,__PYX_ERR(0, 126, __pyx_L1_error))
3969 __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_outliers, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 126, __pyx_L1_error)
3978 __Pyx_TraceLine(127,0,__PYX_ERR(0, 127, __pyx_L1_error))
3979 __pyx_t_23 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_converged, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_23.memview)) __PYX_ERR(0, 127, __pyx_L1_error)
3988 __Pyx_TraceLine(103,0,__PYX_ERR(0, 103, __pyx_L1_error))
3989 __pyx_t_4 = __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_double(__pyx_v_Aop, __pyx_v_parameters, __pyx_t_16, __pyx_v_py_matrix_function, __pyx_t_24, __pyx_t_25, __pyx_t_6, __pyx_t_7, __pyx_t_11, __pyx_t_26, __pyx_t_10, __pyx_t_8, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_2, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_22, __pyx_t_21, __pyx_t_20, __pyx_t_23, __pyx_v_alg_wall_time);
if (unlikely(__pyx_t_4 == ((__pyx_t_5imate_12_definitions_5types_FlagType)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
3990 __PYX_XDEC_MEMVIEW(&__pyx_t_31, 1);
3991 __pyx_t_31.memview = NULL;
3992 __pyx_t_31.data = NULL;
3993 __PYX_XDEC_MEMVIEW(&__pyx_t_32, 1);
3994 __pyx_t_32.memview = NULL;
3995 __pyx_t_32.data = NULL;
3996 __PYX_XDEC_MEMVIEW(&__pyx_t_33, 1);
3997 __pyx_t_33.memview = NULL;
3998 __pyx_t_33.data = NULL;
3999 __PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
4000 __pyx_t_22.memview = NULL;
4001 __pyx_t_22.data = NULL;
4002 __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
4003 __pyx_t_21.memview = NULL;
4004 __pyx_t_21.data = NULL;
4005 __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
4006 __pyx_t_20.memview = NULL;
4007 __pyx_t_20.data = NULL;
4008 __PYX_XDEC_MEMVIEW(&__pyx_t_23, 1);
4009 __pyx_t_23.memview = NULL;
4010 __pyx_t_23.data = NULL;
4011 __pyx_v_all_converged = __pyx_t_4;
4030 __Pyx_TraceLine(130,0,__PYX_ERR(0, 130, __pyx_L1_error))
4031 __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float128, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 130, __pyx_L1_error)
4032 if (likely(__pyx_t_1)) {
4041 __Pyx_TraceLine(135,0,__PYX_ERR(0, 135, __pyx_L1_error))
4042 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_num_inquiries);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
4051 __Pyx_TraceLine(137,0,__PYX_ERR(0, 137, __pyx_L1_error))
4052 __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_gram);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error)
4053 __Pyx_GOTREF(__pyx_t_3);
4054 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L1_error)
4055 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4064 __Pyx_TraceLine(138,0,__PYX_ERR(0, 138, __pyx_L1_error))
4065 __pyx_t_34 = __pyx_PyFloat_AsDouble(__pyx_v_exponent);
if (unlikely((__pyx_t_34 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
4074 __Pyx_TraceLine(139,0,__PYX_ERR(0, 139, __pyx_L1_error))
4075 __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_reorthogonalize);
if (unlikely((__pyx_t_6 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error)
4084 __Pyx_TraceLine(140,0,__PYX_ERR(0, 140, __pyx_L1_error))
4085 __pyx_t_7 = __Pyx_PyInt_As_int64_t(__pyx_v_seed);
if (unlikely((__pyx_t_7 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error)
4094 __Pyx_TraceLine(141,0,__PYX_ERR(0, 141, __pyx_L1_error))
4095 __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_lanczos_degree);
if (unlikely((__pyx_t_8 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
4104 __Pyx_TraceLine(142,0,__PYX_ERR(0, 142, __pyx_L1_error))
4105 __pyx_t_35 = __pyx_PyFloat_AsDouble(__pyx_v_lanczos_tol);
if (unlikely((__pyx_t_35 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
4114 __Pyx_TraceLine(143,0,__PYX_ERR(0, 143, __pyx_L1_error))
4115 __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_min_num_samples);
if (unlikely((__pyx_t_10 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L1_error)
4124 __Pyx_TraceLine(144,0,__PYX_ERR(0, 144, __pyx_L1_error))
4125 __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples);
if (unlikely((__pyx_t_11 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error)
4134 __Pyx_TraceLine(145,0,__PYX_ERR(0, 145, __pyx_L1_error))
4135 __pyx_t_36 = __pyx_PyFloat_AsDouble(__pyx_v_error_atol);
if (unlikely((__pyx_t_36 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error)
4144 __Pyx_TraceLine(146,0,__PYX_ERR(0, 146, __pyx_L1_error))
4145 __pyx_t_37 = __pyx_PyFloat_AsDouble(__pyx_v_error_rtol);
if (unlikely((__pyx_t_37 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L1_error)
4154 __Pyx_TraceLine(147,0,__PYX_ERR(0, 147, __pyx_L1_error))
4155 __pyx_t_38 = __pyx_PyFloat_AsDouble(__pyx_v_confidence_level);
if (unlikely((__pyx_t_38 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L1_error)
4164 __Pyx_TraceLine(148,0,__PYX_ERR(0, 148, __pyx_L1_error))
4165 __pyx_t_39 = __pyx_PyFloat_AsDouble(__pyx_v_outlier_significance_level);
if (unlikely((__pyx_t_39 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
4174 __Pyx_TraceLine(149,0,__PYX_ERR(0, 149, __pyx_L1_error))
4175 __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_num_threads);
if (unlikely((__pyx_t_16 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L1_error)
4184 __Pyx_TraceLine(150,0,__PYX_ERR(0, 150, __pyx_L1_error))
4185 __pyx_t_40 = __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(__pyx_v_trace, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_40.memview)) __PYX_ERR(0, 150, __pyx_L1_error)
4194 __Pyx_TraceLine(151,0,__PYX_ERR(0, 151, __pyx_L1_error))
4195 __pyx_t_41 = __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(__pyx_v_error, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_41.memview)) __PYX_ERR(0, 151, __pyx_L1_error)
4204 __Pyx_TraceLine(152,0,__PYX_ERR(0, 152, __pyx_L1_error))
4205 __pyx_t_42 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long__double(__pyx_v_samples, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_42.memview)) __PYX_ERR(0, 152, __pyx_L1_error)
4214 __Pyx_TraceLine(153,0,__PYX_ERR(0, 153, __pyx_L1_error))
4215 __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_processed_samples_indices, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 153, __pyx_L1_error)
4224 __Pyx_TraceLine(154,0,__PYX_ERR(0, 154, __pyx_L1_error))
4225 __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_samples_used, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(0, 154, __pyx_L1_error)
4234 __Pyx_TraceLine(155,0,__PYX_ERR(0, 155, __pyx_L1_error))
4235 __pyx_t_22 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_outliers, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_22.memview)) __PYX_ERR(0, 155, __pyx_L1_error)
4244 __Pyx_TraceLine(156,0,__PYX_ERR(0, 156, __pyx_L1_error))
4245 __pyx_t_23 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_converged, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_23.memview)) __PYX_ERR(0, 156, __pyx_L1_error)
4254 __Pyx_TraceLine(132,0,__PYX_ERR(0, 132, __pyx_L1_error))
4255 __pyx_t_24 = __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_long_double(__pyx_v_Aop, __pyx_v_parameters, __pyx_t_2, __pyx_v_py_matrix_function, __pyx_t_4, __pyx_t_34, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_35, __pyx_t_10, __pyx_t_11, __pyx_t_36, __pyx_t_37, __pyx_t_38, __pyx_t_39, __pyx_t_16, __pyx_t_40, __pyx_t_41, __pyx_t_42, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_v_alg_wall_time);
if (unlikely(__pyx_t_24 == ((__pyx_t_5imate_12_definitions_5types_FlagType)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
4256 __PYX_XDEC_MEMVIEW(&__pyx_t_40, 1);
4257 __pyx_t_40.memview = NULL;
4258 __pyx_t_40.data = NULL;
4259 __PYX_XDEC_MEMVIEW(&__pyx_t_41, 1);
4260 __pyx_t_41.memview = NULL;
4261 __pyx_t_41.data = NULL;
4262 __PYX_XDEC_MEMVIEW(&__pyx_t_42, 1);
4263 __pyx_t_42.memview = NULL;
4264 __pyx_t_42.data = NULL;
4265 __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
4266 __pyx_t_20.memview = NULL;
4267 __pyx_t_20.data = NULL;
4268 __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
4269 __pyx_t_21.memview = NULL;
4270 __pyx_t_21.data = NULL;
4271 __PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
4272 __pyx_t_22.memview = NULL;
4273 __pyx_t_22.data = NULL;
4274 __PYX_XDEC_MEMVIEW(&__pyx_t_23, 1);
4275 __pyx_t_23.memview = NULL;
4276 __pyx_t_23.data = NULL;
4277 __pyx_v_all_converged = __pyx_t_24;
4296 __Pyx_TraceLine(160,0,__PYX_ERR(0, 160, __pyx_L1_error))
4298 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error)
4299 __Pyx_GOTREF(__pyx_t_3);
4300 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4301 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4302 __PYX_ERR(0, 160, __pyx_L1_error)
4313 __Pyx_TraceLine(164,0,__PYX_ERR(0, 164, __pyx_L1_error))
4314 __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alg_wall_time);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error)
4315 __Pyx_GOTREF(__pyx_t_3);
4316 if (unlikely(__Pyx_SetItemInt(__pyx_v_alg_wall_times, 0, __pyx_t_3,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 164, __pyx_L1_error)
4317 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4326 __Pyx_TraceLine(166,0,__PYX_ERR(0, 166, __pyx_L1_error))
4327 __pyx_r = __pyx_v_all_converged;
4340 __Pyx_XDECREF(__pyx_t_3);
4341 __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
4342 __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
4343 __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
4344 __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
4345 __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
4346 __PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
4347 __PYX_XDEC_MEMVIEW(&__pyx_t_23, 1);
4348 __PYX_XDEC_MEMVIEW(&__pyx_t_31, 1);
4349 __PYX_XDEC_MEMVIEW(&__pyx_t_32, 1);
4350 __PYX_XDEC_MEMVIEW(&__pyx_t_33, 1);
4351 __PYX_XDEC_MEMVIEW(&__pyx_t_40, 1);
4352 __PYX_XDEC_MEMVIEW(&__pyx_t_41, 1);
4353 __PYX_XDEC_MEMVIEW(&__pyx_t_42, 1);
4354 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator.pyc_trace_estimator", __pyx_clineno, __pyx_lineno, __pyx_filename);
4357 __Pyx_TraceReturn(Py_None, 0);
4358 __Pyx_RefNannyFinishContext();
4363 static PyObject *__pyx_pw_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4364 static char __pyx_doc_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator[] =
"pyc_trace_estimator(pycLinearOperator Aop, parameters, num_inquiries, pyFunction py_matrix_function, gram, exponent, reorthogonalize, seed, lanczos_degree, lanczos_tol, min_num_samples, max_num_samples, error_atol, error_rtol, confidence_level, outlier_significance_level, num_threads, data_type_name, trace, error, samples, processed_samples_indices, num_samples_used, num_outliers, converged, alg_wall_times) -> FlagType\n\n ";
4365 static PyMethodDef __pyx_mdef_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator = {
"pyc_trace_estimator", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator};
4366 static PyObject *__pyx_pw_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4367 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop = 0;
4368 PyObject *__pyx_v_parameters = 0;
4369 PyObject *__pyx_v_num_inquiries = 0;
4370 struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function = 0;
4371 PyObject *__pyx_v_gram = 0;
4372 PyObject *__pyx_v_exponent = 0;
4373 PyObject *__pyx_v_reorthogonalize = 0;
4374 PyObject *__pyx_v_seed = 0;
4375 PyObject *__pyx_v_lanczos_degree = 0;
4376 PyObject *__pyx_v_lanczos_tol = 0;
4377 PyObject *__pyx_v_min_num_samples = 0;
4378 PyObject *__pyx_v_max_num_samples = 0;
4379 PyObject *__pyx_v_error_atol = 0;
4380 PyObject *__pyx_v_error_rtol = 0;
4381 PyObject *__pyx_v_confidence_level = 0;
4382 PyObject *__pyx_v_outlier_significance_level = 0;
4383 PyObject *__pyx_v_num_threads = 0;
4384 PyObject *__pyx_v_data_type_name = 0;
4385 PyObject *__pyx_v_trace = 0;
4386 PyObject *__pyx_v_error = 0;
4387 PyObject *__pyx_v_samples = 0;
4388 PyObject *__pyx_v_processed_samples_indices = 0;
4389 PyObject *__pyx_v_num_samples_used = 0;
4390 PyObject *__pyx_v_num_outliers = 0;
4391 PyObject *__pyx_v_converged = 0;
4392 PyObject *__pyx_v_alg_wall_times = 0;
4393 int __pyx_lineno = 0;
4394 const char *__pyx_filename = NULL;
4395 int __pyx_clineno = 0;
4396 PyObject *__pyx_r = 0;
4397 __Pyx_RefNannyDeclarations
4398 __Pyx_RefNannySetupContext(
"pyc_trace_estimator (wrapper)", 0);
4400 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Aop,&__pyx_n_s_parameters,&__pyx_n_s_num_inquiries,&__pyx_n_s_py_matrix_function,&__pyx_n_s_gram,&__pyx_n_s_exponent,&__pyx_n_s_reorthogonalize,&__pyx_n_s_seed,&__pyx_n_s_lanczos_degree,&__pyx_n_s_lanczos_tol,&__pyx_n_s_min_num_samples,&__pyx_n_s_max_num_samples,&__pyx_n_s_error_atol,&__pyx_n_s_error_rtol,&__pyx_n_s_confidence_level,&__pyx_n_s_outlier_significance_level,&__pyx_n_s_num_threads,&__pyx_n_s_data_type_name,&__pyx_n_s_trace,&__pyx_n_s_error,&__pyx_n_s_samples,&__pyx_n_s_processed_samples_indices,&__pyx_n_s_num_samples_used,&__pyx_n_s_num_outliers,&__pyx_n_s_converged,&__pyx_n_s_alg_wall_times,0};
4401 PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
4402 if (unlikely(__pyx_kwds)) {
4404 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4406 case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
4408 case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
4410 case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
4412 case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
4414 case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
4416 case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
4418 case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
4420 case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
4422 case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
4424 case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
4426 case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
4428 case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
4430 case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
4432 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
4434 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
4436 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
4438 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
4440 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
4442 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4444 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4446 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4448 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4450 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4452 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4454 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4456 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4459 default:
goto __pyx_L5_argtuple_error;
4461 kw_args = PyDict_Size(__pyx_kwds);
4464 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Aop)) != 0)) kw_args--;
4465 else goto __pyx_L5_argtuple_error;
4468 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
4470 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 1); __PYX_ERR(0, 39, __pyx_L3_error)
4474 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_inquiries)) != 0)) kw_args--;
4476 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 2); __PYX_ERR(0, 39, __pyx_L3_error)
4480 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_matrix_function)) != 0)) kw_args--;
4482 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 3); __PYX_ERR(0, 39, __pyx_L3_error)
4486 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram)) != 0)) kw_args--;
4488 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 4); __PYX_ERR(0, 39, __pyx_L3_error)
4492 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exponent)) != 0)) kw_args--;
4494 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 5); __PYX_ERR(0, 39, __pyx_L3_error)
4498 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reorthogonalize)) != 0)) kw_args--;
4500 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 6); __PYX_ERR(0, 39, __pyx_L3_error)
4504 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed)) != 0)) kw_args--;
4506 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 7); __PYX_ERR(0, 39, __pyx_L3_error)
4510 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lanczos_degree)) != 0)) kw_args--;
4512 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 8); __PYX_ERR(0, 39, __pyx_L3_error)
4516 if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lanczos_tol)) != 0)) kw_args--;
4518 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 9); __PYX_ERR(0, 39, __pyx_L3_error)
4522 if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_num_samples)) != 0)) kw_args--;
4524 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 10); __PYX_ERR(0, 39, __pyx_L3_error)
4528 if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_samples)) != 0)) kw_args--;
4530 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 11); __PYX_ERR(0, 39, __pyx_L3_error)
4534 if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_atol)) != 0)) kw_args--;
4536 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 12); __PYX_ERR(0, 39, __pyx_L3_error)
4540 if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_rtol)) != 0)) kw_args--;
4542 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 13); __PYX_ERR(0, 39, __pyx_L3_error)
4546 if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_confidence_level)) != 0)) kw_args--;
4548 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 14); __PYX_ERR(0, 39, __pyx_L3_error)
4552 if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outlier_significance_level)) != 0)) kw_args--;
4554 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 15); __PYX_ERR(0, 39, __pyx_L3_error)
4558 if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--;
4560 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 16); __PYX_ERR(0, 39, __pyx_L3_error)
4564 if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_type_name)) != 0)) kw_args--;
4566 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 17); __PYX_ERR(0, 39, __pyx_L3_error)
4570 if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trace)) != 0)) kw_args--;
4572 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 18); __PYX_ERR(0, 39, __pyx_L3_error)
4576 if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error)) != 0)) kw_args--;
4578 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 19); __PYX_ERR(0, 39, __pyx_L3_error)
4582 if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samples)) != 0)) kw_args--;
4584 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 20); __PYX_ERR(0, 39, __pyx_L3_error)
4588 if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_processed_samples_indices)) != 0)) kw_args--;
4590 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 21); __PYX_ERR(0, 39, __pyx_L3_error)
4594 if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_samples_used)) != 0)) kw_args--;
4596 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 22); __PYX_ERR(0, 39, __pyx_L3_error)
4600 if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_outliers)) != 0)) kw_args--;
4602 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 23); __PYX_ERR(0, 39, __pyx_L3_error)
4606 if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_converged)) != 0)) kw_args--;
4608 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 24); __PYX_ERR(0, 39, __pyx_L3_error)
4612 if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alg_wall_times)) != 0)) kw_args--;
4614 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, 25); __PYX_ERR(0, 39, __pyx_L3_error)
4617 if (unlikely(kw_args > 0)) {
4618 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"pyc_trace_estimator") < 0)) __PYX_ERR(0, 39, __pyx_L3_error)
4620 }
else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
4621 goto __pyx_L5_argtuple_error;
4623 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4624 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4625 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4626 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4627 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4628 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4629 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4630 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4631 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
4632 values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
4633 values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
4634 values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
4635 values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
4636 values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
4637 values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
4638 values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
4639 values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
4640 values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
4641 values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
4642 values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
4643 values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
4644 values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
4645 values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
4646 values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
4647 values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
4648 values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
4650 __pyx_v_Aop = ((
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *)values[0]);
4651 __pyx_v_parameters = values[1];
4652 __pyx_v_num_inquiries = values[2];
4653 __pyx_v_py_matrix_function = ((
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *)values[3]);
4654 __pyx_v_gram = values[4];
4655 __pyx_v_exponent = values[5];
4656 __pyx_v_reorthogonalize = values[6];
4657 __pyx_v_seed = values[7];
4658 __pyx_v_lanczos_degree = values[8];
4659 __pyx_v_lanczos_tol = values[9];
4660 __pyx_v_min_num_samples = values[10];
4661 __pyx_v_max_num_samples = values[11];
4662 __pyx_v_error_atol = values[12];
4663 __pyx_v_error_rtol = values[13];
4664 __pyx_v_confidence_level = values[14];
4665 __pyx_v_outlier_significance_level = values[15];
4666 __pyx_v_num_threads = values[16];
4667 __pyx_v_data_type_name = values[17];
4668 __pyx_v_trace = values[18];
4669 __pyx_v_error = values[19];
4670 __pyx_v_samples = values[20];
4671 __pyx_v_processed_samples_indices = values[21];
4672 __pyx_v_num_samples_used = values[22];
4673 __pyx_v_num_outliers = values[23];
4674 __pyx_v_converged = values[24];
4675 __pyx_v_alg_wall_times = values[25];
4677 goto __pyx_L4_argument_unpacking_done;
4678 __pyx_L5_argtuple_error:;
4679 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 39, __pyx_L3_error)
4681 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator.pyc_trace_estimator", __pyx_clineno, __pyx_lineno, __pyx_filename);
4682 __Pyx_RefNannyFinishContext();
4684 __pyx_L4_argument_unpacking_done:;
4685 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Aop), __pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator, 1,
"Aop", 0))) __PYX_ERR(0, 40, __pyx_L1_error)
4686 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_matrix_function), __pyx_ptype_5imate_9functions_12py_functions_pyFunction, 1,
"py_matrix_function", 0))) __PYX_ERR(0, 43, __pyx_L1_error)
4687 __pyx_r = __pyx_pf_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(__pyx_self, __pyx_v_Aop, __pyx_v_parameters, __pyx_v_num_inquiries, __pyx_v_py_matrix_function, __pyx_v_gram, __pyx_v_exponent, __pyx_v_reorthogonalize, __pyx_v_seed, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_data_type_name, __pyx_v_trace, __pyx_v_error, __pyx_v_samples, __pyx_v_processed_samples_indices, __pyx_v_num_samples_used, __pyx_v_num_outliers, __pyx_v_converged, __pyx_v_alg_wall_times);
4694 __Pyx_RefNannyFinishContext();
4698 static PyObject *__pyx_pf_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(CYTHON_UNUSED PyObject *__pyx_self,
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, PyObject *__pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, PyObject *__pyx_v_gram, PyObject *__pyx_v_exponent, PyObject *__pyx_v_reorthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_lanczos_degree, PyObject *__pyx_v_lanczos_tol, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_data_type_name, PyObject *__pyx_v_trace, PyObject *__pyx_v_error, PyObject *__pyx_v_samples, PyObject *__pyx_v_processed_samples_indices, PyObject *__pyx_v_num_samples_used, PyObject *__pyx_v_num_outliers, PyObject *__pyx_v_converged, PyObject *__pyx_v_alg_wall_times) {
4699 PyObject *__pyx_r = NULL;
4700 __Pyx_TraceDeclarations
4701 __Pyx_RefNannyDeclarations
4702 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_t_1;
4703 PyObject *__pyx_t_2 = NULL;
4704 int __pyx_lineno = 0;
4705 const char *__pyx_filename = NULL;
4706 int __pyx_clineno = 0;
4707 __Pyx_TraceFrameInit(__pyx_codeobj_)
4708 __Pyx_RefNannySetupContext(
"pyc_trace_estimator", 0);
4709 __Pyx_TraceCall(
"pyc_trace_estimator (wrapper)", __pyx_f[0], 39, 0, __PYX_ERR(0, 39, __pyx_L1_error));
4710 __Pyx_XDECREF(__pyx_r);
4711 __pyx_t_1 = __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(__pyx_v_Aop, __pyx_v_parameters, __pyx_v_num_inquiries, __pyx_v_py_matrix_function, __pyx_v_gram, __pyx_v_exponent, __pyx_v_reorthogonalize, __pyx_v_seed, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_data_type_name, __pyx_v_trace, __pyx_v_error, __pyx_v_samples, __pyx_v_processed_samples_indices, __pyx_v_num_samples_used, __pyx_v_num_outliers, __pyx_v_converged, __pyx_v_alg_wall_times, 0);
if (unlikely(__pyx_t_1 == ((__pyx_t_5imate_12_definitions_5types_FlagType)-1) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L1_error)
4712 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
4713 __Pyx_GOTREF(__pyx_t_2);
4714 __pyx_r = __pyx_t_2;
4720 __Pyx_XDECREF(__pyx_t_2);
4721 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator.pyc_trace_estimator", __pyx_clineno, __pyx_lineno, __pyx_filename);
4724 __Pyx_XGIVEREF(__pyx_r);
4725 __Pyx_TraceReturn(__pyx_r, 0);
4726 __Pyx_RefNannyFinishContext();
4738 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_float(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_gram,
float const __pyx_v_exponent, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_reorthogonalize, int64_t
const __pyx_v_seed, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_lanczos_degree,
float const __pyx_v_lanczos_tol, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_min_num_samples, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_max_num_samples,
float const __pyx_v_error_atol,
float const __pyx_v_error_rtol,
float const __pyx_v_confidence_level,
float const __pyx_v_outlier_significance_level, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_threads, __Pyx_memviewslice __pyx_v_trace, __Pyx_memviewslice __pyx_v_error, __Pyx_memviewslice __pyx_v_samples, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_processed_samples_indices, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_samples_used, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_outliers, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType __pyx_v_converged,
float &__pyx_v_alg_wall_time) {
4739 float *__pyx_v_c_parameters;
4740 float __pyx_v_scalar_parameters;
4741 __Pyx_memviewslice __pyx_v_array_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
4742 float *__pyx_v_c_trace;
4743 float *__pyx_v_c_error;
4744 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_processed_samples_indices;
4745 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_samples_used;
4746 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_outliers;
4747 __pyx_t_5imate_12_definitions_5types_FlagType *__pyx_v_c_converged;
4748 float **__pyx_v_c_samples;
4749 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_i;
4750 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_j;
4753 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_v_all_converged;
4754 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_r;
4755 __Pyx_TraceDeclarations
4756 __Pyx_RefNannyDeclarations
4759 PyObject *__pyx_t_3 = NULL;
4760 PyObject *__pyx_t_4 = NULL;
4761 PyObject *__pyx_t_5 = NULL;
4763 __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
4764 Py_ssize_t __pyx_t_8;
4765 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_9;
4766 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
4767 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
4768 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
4769 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
4770 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_14;
4774 Py_ssize_t __pyx_t_18;
4775 Py_ssize_t __pyx_t_19;
4776 int __pyx_lineno = 0;
4777 const char *__pyx_filename = NULL;
4778 int __pyx_clineno = 0;
4779 __Pyx_RefNannySetupContext(
"_pyc_trace_estimator_float", 0);
4780 __Pyx_TraceCall(
"_pyc_trace_estimator_float", __pyx_f[0], 173, 0, __PYX_ERR(0, 173, __pyx_L1_error));
4789 __Pyx_TraceLine(207,0,__PYX_ERR(0, 207, __pyx_L1_error))
4790 __pyx_t_1 = (__pyx_v_parameters == Py_None);
4791 __pyx_t_2 = (__pyx_t_1 != 0);
4801 __Pyx_TraceLine(208,0,__PYX_ERR(0, 208, __pyx_L1_error))
4802 __pyx_v_c_parameters = NULL;
4821 __Pyx_TraceLine(210,0,__PYX_ERR(0, 210, __pyx_L1_error))
4822 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
4823 __Pyx_GOTREF(__pyx_t_4);
4824 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isscalar);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error)
4825 __Pyx_GOTREF(__pyx_t_5);
4826 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4828 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4829 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
4830 if (likely(__pyx_t_4)) {
4831 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
4832 __Pyx_INCREF(__pyx_t_4);
4833 __Pyx_INCREF(
function);
4834 __Pyx_DECREF_SET(__pyx_t_5,
function);
4837 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_parameters);
4838 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4839 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)
4840 __Pyx_GOTREF(__pyx_t_3);
4841 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4842 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
4843 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4853 __Pyx_TraceLine(211,0,__PYX_ERR(0, 211, __pyx_L1_error))
4854 __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_v_parameters);
if (unlikely((__pyx_t_6 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error)
4855 __pyx_v_scalar_parameters = __pyx_t_6;
4864 __Pyx_TraceLine(212,0,__PYX_ERR(0, 212, __pyx_L1_error))
4865 __pyx_v_c_parameters = (&__pyx_v_scalar_parameters);
4884 __Pyx_TraceLine(215,0,__PYX_ERR(0, 215, __pyx_L1_error))
4886 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_parameters, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 215, __pyx_L1_error)
4887 __pyx_v_array_parameters = __pyx_t_7;
4888 __pyx_t_7.memview = NULL;
4889 __pyx_t_7.data = NULL;
4898 __Pyx_TraceLine(216,0,__PYX_ERR(0, 216, __pyx_L1_error))
4900 __pyx_v_c_parameters = (&(*((
float *) ( (__pyx_v_array_parameters.data + __pyx_t_8 * __pyx_v_array_parameters.strides[0]) ))));
4911 __Pyx_TraceLine(219,0,__PYX_ERR(0, 219, __pyx_L1_error))
4913 __pyx_v_c_trace = (&(*((
float *) ( (__pyx_v_trace.data + __pyx_t_8 * __pyx_v_trace.strides[0]) ))));
4922 __Pyx_TraceLine(220,0,__PYX_ERR(0, 220, __pyx_L1_error))
4924 __pyx_v_c_error = (&(*((
float *) ( (__pyx_v_error.data + __pyx_t_8 * __pyx_v_error.strides[0]) ))));
4933 __Pyx_TraceLine(221,0,__PYX_ERR(0, 221, __pyx_L1_error))
4935 __pyx_v_c_processed_samples_indices = (&(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) ))));
4944 __Pyx_TraceLine(222,0,__PYX_ERR(0, 222, __pyx_L1_error))
4946 __pyx_v_c_num_samples_used = (&(*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) ))));
4955 __Pyx_TraceLine(223,0,__PYX_ERR(0, 223, __pyx_L1_error))
4957 __pyx_v_c_num_outliers = (&(*((
int *) ( (__pyx_v_num_outliers.data + __pyx_t_8 * __pyx_v_num_outliers.strides[0]) ))));
4966 __Pyx_TraceLine(224,0,__PYX_ERR(0, 224, __pyx_L1_error))
4968 __pyx_v_c_converged = (&(*((
int *) ( (__pyx_v_converged.data + __pyx_t_8 * __pyx_v_converged.strides[0]) ))));
4977 __Pyx_TraceLine(228,0,__PYX_ERR(0, 228, __pyx_L1_error))
4978 __pyx_v_c_samples = ((
float **)malloc(((
sizeof(
float *)) * __pyx_v_max_num_samples)));
4987 __Pyx_TraceLine(230,0,__PYX_ERR(0, 230, __pyx_L1_error))
4988 __pyx_t_9 = __pyx_v_max_num_samples;
4989 __pyx_t_10 = __pyx_t_9;
4990 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
4991 __pyx_v_i = __pyx_t_11;
5000 __Pyx_TraceLine(231,0,__PYX_ERR(0, 231, __pyx_L1_error))
5001 (__pyx_v_c_samples[__pyx_v_i]) = ((
float *)malloc(((
sizeof(
float)) * __pyx_v_num_inquiries)));
5010 __Pyx_TraceLine(233,0,__PYX_ERR(0, 233, __pyx_L1_error))
5011 __pyx_t_12 = __pyx_v_num_inquiries;
5012 __pyx_t_13 = __pyx_t_12;
5013 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5014 __pyx_v_j = __pyx_t_14;
5023 __Pyx_TraceLine(234,0,__PYX_ERR(0, 234, __pyx_L1_error))
5024 ((__pyx_v_c_samples[__pyx_v_i])[__pyx_v_j]) = NAN;
5035 __Pyx_TraceLine(237,0,__PYX_ERR(0, 237, __pyx_L1_error))
5036 __pyx_t_15 = ((
struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *)__pyx_v_Aop->__pyx_vtab)->get_linear_operator_float(__pyx_v_Aop);
if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error)
5037 __pyx_v_Aop_float = __pyx_t_15;
5046 __Pyx_TraceLine(239,0,__PYX_ERR(0, 239, __pyx_L1_error))
5047 __pyx_v_matrix_function = ((
struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *)__pyx_v_py_matrix_function->__pyx_vtab)->get_function(__pyx_v_py_matrix_function);
5056 __Pyx_TraceLine(243,0,__PYX_ERR(0, 243, __pyx_L1_error))
5057 __pyx_v_all_converged =
cTraceEstimator<float> ::c_trace_estimator(__pyx_v_Aop_float, __pyx_v_c_parameters, __pyx_v_num_inquiries, __pyx_v_matrix_function, __pyx_v_gram, __pyx_v_exponent, __pyx_v_reorthogonalize, __pyx_v_seed, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_c_trace, __pyx_v_c_error, __pyx_v_c_samples, __pyx_v_c_processed_samples_indices, __pyx_v_c_num_samples_used, __pyx_v_c_num_outliers, __pyx_v_c_converged, __pyx_v_alg_wall_time);
5066 __Pyx_TraceLine(272,0,__PYX_ERR(0, 272, __pyx_L1_error))
5067 __pyx_t_9 = __pyx_v_num_inquiries;
5068 __pyx_t_10 = __pyx_t_9;
5069 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5070 __pyx_v_j = __pyx_t_11;
5079 __Pyx_TraceLine(273,0,__PYX_ERR(0, 273, __pyx_L1_error))
5080 __pyx_t_8 = __pyx_v_j;
5081 __pyx_t_16 = (*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) )));
5082 __pyx_t_17 = __pyx_t_16;
5083 for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_17; __pyx_t_12+=1) {
5084 __pyx_v_i = __pyx_t_12;
5093 __Pyx_TraceLine(274,0,__PYX_ERR(0, 274, __pyx_L1_error))
5094 __pyx_t_8 = __pyx_v_i;
5095 __pyx_t_18 = __pyx_v_i;
5096 __pyx_t_19 = __pyx_v_j;
5097 *((
float *) ( ((
char *) (((
float *) ( (__pyx_v_samples.data + __pyx_t_18 * __pyx_v_samples.strides[0]) )) + __pyx_t_19)) )) = ((__pyx_v_c_samples[(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) )))])[__pyx_v_j]);
5108 __Pyx_TraceLine(279,0,__PYX_ERR(0, 279, __pyx_L1_error))
5109 __pyx_t_9 = __pyx_v_max_num_samples;
5110 __pyx_t_10 = __pyx_t_9;
5111 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5112 __pyx_v_i = __pyx_t_11;
5121 __Pyx_TraceLine(280,0,__PYX_ERR(0, 280, __pyx_L1_error))
5122 free((__pyx_v_c_samples[__pyx_v_i]));
5132 __Pyx_TraceLine(281,0,__PYX_ERR(0, 281, __pyx_L1_error))
5133 free(__pyx_v_c_samples);
5142 __Pyx_TraceLine(283,0,__PYX_ERR(0, 283, __pyx_L1_error))
5143 __pyx_r = __pyx_v_all_converged;
5156 __Pyx_XDECREF(__pyx_t_3);
5157 __Pyx_XDECREF(__pyx_t_4);
5158 __Pyx_XDECREF(__pyx_t_5);
5159 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
5160 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator._pyc_trace_estimator_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
5163 __PYX_XDEC_MEMVIEW(&__pyx_v_array_parameters, 1);
5164 __Pyx_TraceReturn(Py_None, 0);
5165 __Pyx_RefNannyFinishContext();
5177 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_double(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_gram,
double const __pyx_v_exponent, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_reorthogonalize, int64_t
const __pyx_v_seed, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_lanczos_degree,
double const __pyx_v_lanczos_tol, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_min_num_samples, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_max_num_samples,
double const __pyx_v_error_atol,
double const __pyx_v_error_rtol,
double const __pyx_v_confidence_level,
double const __pyx_v_outlier_significance_level, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_threads, __Pyx_memviewslice __pyx_v_trace, __Pyx_memviewslice __pyx_v_error, __Pyx_memviewslice __pyx_v_samples, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_processed_samples_indices, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_samples_used, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_outliers, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType __pyx_v_converged,
float &__pyx_v_alg_wall_time) {
5178 double *__pyx_v_c_parameters;
5179 double __pyx_v_scalar_parameters;
5180 __Pyx_memviewslice __pyx_v_array_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
5181 double *__pyx_v_c_trace;
5182 double *__pyx_v_c_error;
5183 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_processed_samples_indices;
5184 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_samples_used;
5185 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_outliers;
5186 __pyx_t_5imate_12_definitions_5types_FlagType *__pyx_v_c_converged;
5187 double **__pyx_v_c_samples;
5188 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_i;
5189 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_j;
5192 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_v_all_converged;
5193 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_r;
5194 __Pyx_TraceDeclarations
5195 __Pyx_RefNannyDeclarations
5198 PyObject *__pyx_t_3 = NULL;
5199 PyObject *__pyx_t_4 = NULL;
5200 PyObject *__pyx_t_5 = NULL;
5202 __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
5203 Py_ssize_t __pyx_t_8;
5204 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_9;
5205 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
5206 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
5207 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
5208 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
5209 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_14;
5213 Py_ssize_t __pyx_t_18;
5214 Py_ssize_t __pyx_t_19;
5215 int __pyx_lineno = 0;
5216 const char *__pyx_filename = NULL;
5217 int __pyx_clineno = 0;
5218 __Pyx_RefNannySetupContext(
"_pyc_trace_estimator_double", 0);
5219 __Pyx_TraceCall(
"_pyc_trace_estimator_double", __pyx_f[0], 290, 0, __PYX_ERR(0, 290, __pyx_L1_error));
5228 __Pyx_TraceLine(324,0,__PYX_ERR(0, 324, __pyx_L1_error))
5229 __pyx_t_1 = (__pyx_v_parameters == Py_None);
5230 __pyx_t_2 = (__pyx_t_1 != 0);
5240 __Pyx_TraceLine(325,0,__PYX_ERR(0, 325, __pyx_L1_error))
5241 __pyx_v_c_parameters = NULL;
5260 __Pyx_TraceLine(327,0,__PYX_ERR(0, 327, __pyx_L1_error))
5261 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L1_error)
5262 __Pyx_GOTREF(__pyx_t_4);
5263 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isscalar);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 327, __pyx_L1_error)
5264 __Pyx_GOTREF(__pyx_t_5);
5265 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5267 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5268 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
5269 if (likely(__pyx_t_4)) {
5270 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
5271 __Pyx_INCREF(__pyx_t_4);
5272 __Pyx_INCREF(
function);
5273 __Pyx_DECREF_SET(__pyx_t_5,
function);
5276 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_parameters);
5277 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5278 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
5279 __Pyx_GOTREF(__pyx_t_3);
5280 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5281 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 327, __pyx_L1_error)
5282 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5292 __Pyx_TraceLine(328,0,__PYX_ERR(0, 328, __pyx_L1_error))
5293 __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_parameters);
if (unlikely((__pyx_t_6 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 328, __pyx_L1_error)
5294 __pyx_v_scalar_parameters = __pyx_t_6;
5303 __Pyx_TraceLine(329,0,__PYX_ERR(0, 329, __pyx_L1_error))
5304 __pyx_v_c_parameters = (&__pyx_v_scalar_parameters);
5323 __Pyx_TraceLine(332,0,__PYX_ERR(0, 332, __pyx_L1_error))
5325 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_parameters, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 332, __pyx_L1_error)
5326 __pyx_v_array_parameters = __pyx_t_7;
5327 __pyx_t_7.memview = NULL;
5328 __pyx_t_7.data = NULL;
5337 __Pyx_TraceLine(333,0,__PYX_ERR(0, 333, __pyx_L1_error))
5339 __pyx_v_c_parameters = (&(*((
double *) ( (__pyx_v_array_parameters.data + __pyx_t_8 * __pyx_v_array_parameters.strides[0]) ))));
5350 __Pyx_TraceLine(336,0,__PYX_ERR(0, 336, __pyx_L1_error))
5352 __pyx_v_c_trace = (&(*((
double *) ( (__pyx_v_trace.data + __pyx_t_8 * __pyx_v_trace.strides[0]) ))));
5361 __Pyx_TraceLine(337,0,__PYX_ERR(0, 337, __pyx_L1_error))
5363 __pyx_v_c_error = (&(*((
double *) ( (__pyx_v_error.data + __pyx_t_8 * __pyx_v_error.strides[0]) ))));
5372 __Pyx_TraceLine(338,0,__PYX_ERR(0, 338, __pyx_L1_error))
5374 __pyx_v_c_processed_samples_indices = (&(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) ))));
5383 __Pyx_TraceLine(339,0,__PYX_ERR(0, 339, __pyx_L1_error))
5385 __pyx_v_c_num_samples_used = (&(*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) ))));
5394 __Pyx_TraceLine(340,0,__PYX_ERR(0, 340, __pyx_L1_error))
5396 __pyx_v_c_num_outliers = (&(*((
int *) ( (__pyx_v_num_outliers.data + __pyx_t_8 * __pyx_v_num_outliers.strides[0]) ))));
5405 __Pyx_TraceLine(341,0,__PYX_ERR(0, 341, __pyx_L1_error))
5407 __pyx_v_c_converged = (&(*((
int *) ( (__pyx_v_converged.data + __pyx_t_8 * __pyx_v_converged.strides[0]) ))));
5416 __Pyx_TraceLine(345,0,__PYX_ERR(0, 345, __pyx_L1_error))
5417 __pyx_v_c_samples = ((
double **)malloc(((
sizeof(
double)) * __pyx_v_max_num_samples)));
5426 __Pyx_TraceLine(347,0,__PYX_ERR(0, 347, __pyx_L1_error))
5427 __pyx_t_9 = __pyx_v_max_num_samples;
5428 __pyx_t_10 = __pyx_t_9;
5429 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5430 __pyx_v_i = __pyx_t_11;
5439 __Pyx_TraceLine(348,0,__PYX_ERR(0, 348, __pyx_L1_error))
5440 (__pyx_v_c_samples[__pyx_v_i]) = ((
double *)malloc(((
sizeof(
double *)) * __pyx_v_num_inquiries)));
5449 __Pyx_TraceLine(350,0,__PYX_ERR(0, 350, __pyx_L1_error))
5450 __pyx_t_12 = __pyx_v_num_inquiries;
5451 __pyx_t_13 = __pyx_t_12;
5452 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5453 __pyx_v_j = __pyx_t_14;
5462 __Pyx_TraceLine(351,0,__PYX_ERR(0, 351, __pyx_L1_error))
5463 ((__pyx_v_c_samples[__pyx_v_i])[__pyx_v_j]) = NAN;
5474 __Pyx_TraceLine(354,0,__PYX_ERR(0, 354, __pyx_L1_error))
5475 __pyx_t_15 = ((
struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *)__pyx_v_Aop->__pyx_vtab)->get_linear_operator_double(__pyx_v_Aop);
if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 354, __pyx_L1_error)
5476 __pyx_v_Aop_double = __pyx_t_15;
5485 __Pyx_TraceLine(356,0,__PYX_ERR(0, 356, __pyx_L1_error))
5486 __pyx_v_matrix_function = ((
struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *)__pyx_v_py_matrix_function->__pyx_vtab)->get_function(__pyx_v_py_matrix_function);
5495 __Pyx_TraceLine(360,0,__PYX_ERR(0, 360, __pyx_L1_error))
5496 __pyx_v_all_converged =
cTraceEstimator<double> ::c_trace_estimator(__pyx_v_Aop_double, __pyx_v_c_parameters, __pyx_v_num_inquiries, __pyx_v_matrix_function, __pyx_v_gram, __pyx_v_exponent, __pyx_v_reorthogonalize, __pyx_v_seed, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_c_trace, __pyx_v_c_error, __pyx_v_c_samples, __pyx_v_c_processed_samples_indices, __pyx_v_c_num_samples_used, __pyx_v_c_num_outliers, __pyx_v_c_converged, __pyx_v_alg_wall_time);
5505 __Pyx_TraceLine(389,0,__PYX_ERR(0, 389, __pyx_L1_error))
5506 __pyx_t_9 = __pyx_v_num_inquiries;
5507 __pyx_t_10 = __pyx_t_9;
5508 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5509 __pyx_v_j = __pyx_t_11;
5518 __Pyx_TraceLine(390,0,__PYX_ERR(0, 390, __pyx_L1_error))
5519 __pyx_t_8 = __pyx_v_j;
5520 __pyx_t_16 = (*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) )));
5521 __pyx_t_17 = __pyx_t_16;
5522 for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_17; __pyx_t_12+=1) {
5523 __pyx_v_i = __pyx_t_12;
5532 __Pyx_TraceLine(391,0,__PYX_ERR(0, 391, __pyx_L1_error))
5533 __pyx_t_8 = __pyx_v_i;
5534 __pyx_t_18 = __pyx_v_i;
5535 __pyx_t_19 = __pyx_v_j;
5536 *((
double *) ( ((
char *) (((
double *) ( (__pyx_v_samples.data + __pyx_t_18 * __pyx_v_samples.strides[0]) )) + __pyx_t_19)) )) = ((__pyx_v_c_samples[(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) )))])[__pyx_v_j]);
5547 __Pyx_TraceLine(396,0,__PYX_ERR(0, 396, __pyx_L1_error))
5548 __pyx_t_9 = __pyx_v_max_num_samples;
5549 __pyx_t_10 = __pyx_t_9;
5550 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5551 __pyx_v_i = __pyx_t_11;
5560 __Pyx_TraceLine(397,0,__PYX_ERR(0, 397, __pyx_L1_error))
5561 free((__pyx_v_c_samples[__pyx_v_i]));
5571 __Pyx_TraceLine(398,0,__PYX_ERR(0, 398, __pyx_L1_error))
5572 free(__pyx_v_c_samples);
5581 __Pyx_TraceLine(400,0,__PYX_ERR(0, 400, __pyx_L1_error))
5582 __pyx_r = __pyx_v_all_converged;
5595 __Pyx_XDECREF(__pyx_t_3);
5596 __Pyx_XDECREF(__pyx_t_4);
5597 __Pyx_XDECREF(__pyx_t_5);
5598 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
5599 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator._pyc_trace_estimator_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
5602 __PYX_XDEC_MEMVIEW(&__pyx_v_array_parameters, 1);
5603 __Pyx_TraceReturn(Py_None, 0);
5604 __Pyx_RefNannyFinishContext();
5616 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_long_double(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_gram,
long double const __pyx_v_exponent, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_reorthogonalize, int64_t
const __pyx_v_seed, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_lanczos_degree,
long double const __pyx_v_lanczos_tol, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_min_num_samples, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_max_num_samples,
long double const __pyx_v_error_atol,
long double const __pyx_v_error_rtol,
long double const __pyx_v_confidence_level,
long double const __pyx_v_outlier_significance_level, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_threads, __Pyx_memviewslice __pyx_v_trace, __Pyx_memviewslice __pyx_v_error, __Pyx_memviewslice __pyx_v_samples, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_processed_samples_indices, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_samples_used, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_outliers, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType __pyx_v_converged,
float &__pyx_v_alg_wall_time) {
5617 long double *__pyx_v_c_parameters;
5618 long double __pyx_v_scalar_parameters;
5619 __Pyx_memviewslice __pyx_v_array_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
5620 long double *__pyx_v_c_trace;
5621 long double *__pyx_v_c_error;
5622 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_processed_samples_indices;
5623 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_samples_used;
5624 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_outliers;
5625 __pyx_t_5imate_12_definitions_5types_FlagType *__pyx_v_c_converged;
5626 long double **__pyx_v_c_samples;
5627 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_i;
5628 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_j;
5631 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_v_all_converged;
5632 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_r;
5633 __Pyx_TraceDeclarations
5634 __Pyx_RefNannyDeclarations
5637 PyObject *__pyx_t_3 = NULL;
5638 PyObject *__pyx_t_4 = NULL;
5639 PyObject *__pyx_t_5 = NULL;
5640 long double __pyx_t_6;
5641 __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
5642 Py_ssize_t __pyx_t_8;
5643 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_9;
5644 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
5645 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
5646 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
5647 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
5648 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_14;
5652 Py_ssize_t __pyx_t_18;
5653 Py_ssize_t __pyx_t_19;
5654 int __pyx_lineno = 0;
5655 const char *__pyx_filename = NULL;
5656 int __pyx_clineno = 0;
5657 __Pyx_RefNannySetupContext(
"_pyc_trace_estimator_long_double", 0);
5658 __Pyx_TraceCall(
"_pyc_trace_estimator_long_double", __pyx_f[0], 407, 0, __PYX_ERR(0, 407, __pyx_L1_error));
5667 __Pyx_TraceLine(441,0,__PYX_ERR(0, 441, __pyx_L1_error))
5668 __pyx_t_1 = (__pyx_v_parameters == Py_None);
5669 __pyx_t_2 = (__pyx_t_1 != 0);
5679 __Pyx_TraceLine(442,0,__PYX_ERR(0, 442, __pyx_L1_error))
5680 __pyx_v_c_parameters = NULL;
5699 __Pyx_TraceLine(444,0,__PYX_ERR(0, 444, __pyx_L1_error))
5700 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 444, __pyx_L1_error)
5701 __Pyx_GOTREF(__pyx_t_4);
5702 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isscalar);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 444, __pyx_L1_error)
5703 __Pyx_GOTREF(__pyx_t_5);
5704 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5706 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5707 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
5708 if (likely(__pyx_t_4)) {
5709 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
5710 __Pyx_INCREF(__pyx_t_4);
5711 __Pyx_INCREF(
function);
5712 __Pyx_DECREF_SET(__pyx_t_5,
function);
5715 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_parameters);
5716 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5717 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error)
5718 __Pyx_GOTREF(__pyx_t_3);
5719 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5720 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 444, __pyx_L1_error)
5721 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5731 __Pyx_TraceLine(445,0,__PYX_ERR(0, 445, __pyx_L1_error))
5732 __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_parameters);
if (unlikely((__pyx_t_6 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 445, __pyx_L1_error)
5733 __pyx_v_scalar_parameters = __pyx_t_6;
5742 __Pyx_TraceLine(446,0,__PYX_ERR(0, 446, __pyx_L1_error))
5743 __pyx_v_c_parameters = (&__pyx_v_scalar_parameters);
5762 __Pyx_TraceLine(449,0,__PYX_ERR(0, 449, __pyx_L1_error))
5764 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(__pyx_v_parameters, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 449, __pyx_L1_error)
5765 __pyx_v_array_parameters = __pyx_t_7;
5766 __pyx_t_7.memview = NULL;
5767 __pyx_t_7.data = NULL;
5776 __Pyx_TraceLine(450,0,__PYX_ERR(0, 450, __pyx_L1_error))
5778 __pyx_v_c_parameters = (&(*((
long double *) ( (__pyx_v_array_parameters.data + __pyx_t_8 * __pyx_v_array_parameters.strides[0]) ))));
5789 __Pyx_TraceLine(453,0,__PYX_ERR(0, 453, __pyx_L1_error))
5791 __pyx_v_c_trace = (&(*((
long double *) ( (__pyx_v_trace.data + __pyx_t_8 * __pyx_v_trace.strides[0]) ))));
5800 __Pyx_TraceLine(454,0,__PYX_ERR(0, 454, __pyx_L1_error))
5802 __pyx_v_c_error = (&(*((
long double *) ( (__pyx_v_error.data + __pyx_t_8 * __pyx_v_error.strides[0]) ))));
5811 __Pyx_TraceLine(455,0,__PYX_ERR(0, 455, __pyx_L1_error))
5813 __pyx_v_c_processed_samples_indices = (&(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) ))));
5822 __Pyx_TraceLine(456,0,__PYX_ERR(0, 456, __pyx_L1_error))
5824 __pyx_v_c_num_samples_used = (&(*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) ))));
5833 __Pyx_TraceLine(457,0,__PYX_ERR(0, 457, __pyx_L1_error))
5835 __pyx_v_c_num_outliers = (&(*((
int *) ( (__pyx_v_num_outliers.data + __pyx_t_8 * __pyx_v_num_outliers.strides[0]) ))));
5844 __Pyx_TraceLine(458,0,__PYX_ERR(0, 458, __pyx_L1_error))
5846 __pyx_v_c_converged = (&(*((
int *) ( (__pyx_v_converged.data + __pyx_t_8 * __pyx_v_converged.strides[0]) ))));
5855 __Pyx_TraceLine(462,0,__PYX_ERR(0, 462, __pyx_L1_error))
5856 __pyx_v_c_samples = ((
long double **)malloc(((
sizeof(
long double *)) * __pyx_v_max_num_samples)));
5865 __Pyx_TraceLine(464,0,__PYX_ERR(0, 464, __pyx_L1_error))
5866 __pyx_t_9 = __pyx_v_max_num_samples;
5867 __pyx_t_10 = __pyx_t_9;
5868 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5869 __pyx_v_i = __pyx_t_11;
5878 __Pyx_TraceLine(465,0,__PYX_ERR(0, 465, __pyx_L1_error))
5879 (__pyx_v_c_samples[__pyx_v_i]) = ((
long double *)malloc(((
sizeof(
long double)) * __pyx_v_num_inquiries)));
5888 __Pyx_TraceLine(468,0,__PYX_ERR(0, 468, __pyx_L1_error))
5889 __pyx_t_12 = __pyx_v_num_inquiries;
5890 __pyx_t_13 = __pyx_t_12;
5891 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5892 __pyx_v_j = __pyx_t_14;
5901 __Pyx_TraceLine(469,0,__PYX_ERR(0, 469, __pyx_L1_error))
5902 ((__pyx_v_c_samples[__pyx_v_i])[__pyx_v_j]) = NAN;
5913 __Pyx_TraceLine(473,0,__PYX_ERR(0, 473, __pyx_L1_error))
5914 __pyx_t_15 = ((
struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *)__pyx_v_Aop->__pyx_vtab)->get_linear_operator_long_double(__pyx_v_Aop);
if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 473, __pyx_L1_error)
5915 __pyx_v_Aop_long_double = __pyx_t_15;
5924 __Pyx_TraceLine(475,0,__PYX_ERR(0, 475, __pyx_L1_error))
5925 __pyx_v_matrix_function = ((
struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *)__pyx_v_py_matrix_function->__pyx_vtab)->get_function(__pyx_v_py_matrix_function);
5934 __Pyx_TraceLine(479,0,__PYX_ERR(0, 479, __pyx_L1_error))
5935 __pyx_v_all_converged =
cTraceEstimator<__pyx_t_5imate_18_c_trace_estimator_20py_c_trace_estimator_long_double> ::c_trace_estimator(__pyx_v_Aop_long_double, __pyx_v_c_parameters, __pyx_v_num_inquiries, __pyx_v_matrix_function, __pyx_v_gram, __pyx_v_exponent, __pyx_v_reorthogonalize, __pyx_v_seed, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_c_trace, __pyx_v_c_error, __pyx_v_c_samples, __pyx_v_c_processed_samples_indices, __pyx_v_c_num_samples_used, __pyx_v_c_num_outliers, __pyx_v_c_converged, __pyx_v_alg_wall_time);
5944 __Pyx_TraceLine(508,0,__PYX_ERR(0, 508, __pyx_L1_error))
5945 __pyx_t_9 = __pyx_v_num_inquiries;
5946 __pyx_t_10 = __pyx_t_9;
5947 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5948 __pyx_v_j = __pyx_t_11;
5957 __Pyx_TraceLine(509,0,__PYX_ERR(0, 509, __pyx_L1_error))
5958 __pyx_t_8 = __pyx_v_j;
5959 __pyx_t_16 = (*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) )));
5960 __pyx_t_17 = __pyx_t_16;
5961 for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_17; __pyx_t_12+=1) {
5962 __pyx_v_i = __pyx_t_12;
5971 __Pyx_TraceLine(510,0,__PYX_ERR(0, 510, __pyx_L1_error))
5972 __pyx_t_8 = __pyx_v_i;
5973 __pyx_t_18 = __pyx_v_i;
5974 __pyx_t_19 = __pyx_v_j;
5975 *((
long double *) ( ((
char *) (((
long double *) ( (__pyx_v_samples.data + __pyx_t_18 * __pyx_v_samples.strides[0]) )) + __pyx_t_19)) )) = ((__pyx_v_c_samples[(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) )))])[__pyx_v_j]);
5986 __Pyx_TraceLine(515,0,__PYX_ERR(0, 515, __pyx_L1_error))
5987 __pyx_t_9 = __pyx_v_max_num_samples;
5988 __pyx_t_10 = __pyx_t_9;
5989 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5990 __pyx_v_i = __pyx_t_11;
5999 __Pyx_TraceLine(516,0,__PYX_ERR(0, 516, __pyx_L1_error))
6000 free((__pyx_v_c_samples[__pyx_v_i]));
6010 __Pyx_TraceLine(517,0,__PYX_ERR(0, 517, __pyx_L1_error))
6011 free(__pyx_v_c_samples);
6018 __Pyx_TraceLine(519,0,__PYX_ERR(0, 519, __pyx_L1_error))
6019 __pyx_r = __pyx_v_all_converged;
6032 __Pyx_XDECREF(__pyx_t_3);
6033 __Pyx_XDECREF(__pyx_t_4);
6034 __Pyx_XDECREF(__pyx_t_5);
6035 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
6036 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator._pyc_trace_estimator_long_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
6039 __PYX_XDEC_MEMVIEW(&__pyx_v_array_parameters, 1);
6040 __Pyx_TraceReturn(Py_None, 0);
6041 __Pyx_RefNannyFinishContext();
6054 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
6055 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6056 PyObject *__pyx_v_shape = 0;
6057 Py_ssize_t __pyx_v_itemsize;
6058 PyObject *__pyx_v_format = 0;
6059 PyObject *__pyx_v_mode = 0;
6060 int __pyx_v_allocate_buffer;
6061 int __pyx_lineno = 0;
6062 const char *__pyx_filename = NULL;
6063 int __pyx_clineno = 0;
6065 __Pyx_RefNannyDeclarations
6066 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
6068 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
6069 PyObject* values[5] = {0,0,0,0,0};
6070 values[3] = ((PyObject *)__pyx_n_s_c);
6071 if (unlikely(__pyx_kwds)) {
6073 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6075 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6077 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6079 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6081 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6083 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6086 default:
goto __pyx_L5_argtuple_error;
6088 kw_args = PyDict_Size(__pyx_kwds);
6091 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
6092 else goto __pyx_L5_argtuple_error;
6095 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
6097 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error)
6101 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
6103 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error)
6108 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
6109 if (value) { values[3] = value; kw_args--; }
6114 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
6115 if (value) { values[4] = value; kw_args--; }
6118 if (unlikely(kw_args > 0)) {
6119 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error)
6122 switch (PyTuple_GET_SIZE(__pyx_args)) {
6123 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6125 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6127 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6128 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6129 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6131 default:
goto __pyx_L5_argtuple_error;
6134 __pyx_v_shape = ((PyObject*)values[0]);
6135 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]);
if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
6136 __pyx_v_format = values[2];
6137 __pyx_v_mode = values[3];
6139 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]);
if (unlikely((__pyx_v_allocate_buffer == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error)
6149 __pyx_v_allocate_buffer = ((int)1);
6152 goto __pyx_L4_argument_unpacking_done;
6153 __pyx_L5_argtuple_error:;
6154 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error)
6156 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6157 __Pyx_RefNannyFinishContext();
6159 __pyx_L4_argument_unpacking_done:;
6160 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error)
6161 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
6162 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(2, 123, __pyx_L1_error)
6164 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((
struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
6179 __Pyx_RefNannyFinishContext();
6183 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer) {
6185 Py_ssize_t __pyx_v_i;
6186 Py_ssize_t __pyx_v_dim;
6187 PyObject **__pyx_v_p;
6190 __Pyx_TraceDeclarations
6191 __Pyx_RefNannyDeclarations
6192 Py_ssize_t __pyx_t_1;
6194 PyObject *__pyx_t_3 = NULL;
6196 PyObject *__pyx_t_5 = NULL;
6197 PyObject *__pyx_t_6 = NULL;
6200 Py_ssize_t __pyx_t_9;
6201 PyObject *__pyx_t_10 = NULL;
6202 Py_ssize_t __pyx_t_11;
6203 int __pyx_lineno = 0;
6204 const char *__pyx_filename = NULL;
6205 int __pyx_clineno = 0;
6206 __Pyx_RefNannySetupContext(
"__cinit__", 0);
6207 __Pyx_TraceCall(
"__cinit__", __pyx_f[2], 123, 0, __PYX_ERR(2, 123, __pyx_L1_error));
6208 __Pyx_INCREF(__pyx_v_format);
6217 __Pyx_TraceLine(130,0,__PYX_ERR(2, 130, __pyx_L1_error))
6218 if (unlikely(__pyx_v_shape == Py_None)) {
6219 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
6220 __PYX_ERR(2, 130, __pyx_L1_error)
6222 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape);
if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error)
6223 __pyx_v_self->ndim = ((int)__pyx_t_1);
6232 __Pyx_TraceLine(131,0,__PYX_ERR(2, 131, __pyx_L1_error))
6233 __pyx_v_self->itemsize = __pyx_v_itemsize;
6242 __Pyx_TraceLine(133,0,__PYX_ERR(2, 133, __pyx_L1_error))
6243 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
6244 if (unlikely(__pyx_t_2)) {
6253 __Pyx_TraceLine(134,0,__PYX_ERR(2, 134, __pyx_L1_error))
6254 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error)
6255 __Pyx_GOTREF(__pyx_t_3);
6256 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6257 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6258 __PYX_ERR(2, 134, __pyx_L1_error)
6276 __Pyx_TraceLine(136,0,__PYX_ERR(2, 136, __pyx_L1_error))
6277 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
6278 if (unlikely(__pyx_t_2)) {
6287 __Pyx_TraceLine(137,0,__PYX_ERR(2, 137, __pyx_L1_error))
6288 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error)
6289 __Pyx_GOTREF(__pyx_t_3);
6290 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6291 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6292 __PYX_ERR(2, 137, __pyx_L1_error)
6310 __Pyx_TraceLine(139,0,__PYX_ERR(2, 139, __pyx_L1_error))
6311 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
6312 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
6322 __Pyx_TraceLine(140,0,__PYX_ERR(2, 140, __pyx_L1_error))
6323 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error)
6324 __Pyx_GOTREF(__pyx_t_5);
6326 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6327 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6328 if (likely(__pyx_t_6)) {
6329 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
6330 __Pyx_INCREF(__pyx_t_6);
6331 __Pyx_INCREF(
function);
6332 __Pyx_DECREF_SET(__pyx_t_5,
function);
6335 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
6336 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6337 if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error)
6338 __Pyx_GOTREF(__pyx_t_3);
6339 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6340 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
6359 __Pyx_TraceLine(141,0,__PYX_ERR(2, 141, __pyx_L1_error))
6360 if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error)
6361 __pyx_t_3 = __pyx_v_format;
6362 __Pyx_INCREF(__pyx_t_3);
6363 __Pyx_GIVEREF(__pyx_t_3);
6364 __Pyx_GOTREF(__pyx_v_self->_format);
6365 __Pyx_DECREF(__pyx_v_self->_format);
6366 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
6376 __Pyx_TraceLine(142,0,__PYX_ERR(2, 142, __pyx_L1_error))
6377 if (unlikely(__pyx_v_self->_format == Py_None)) {
6378 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
6379 __PYX_ERR(2, 142, __pyx_L1_error)
6381 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error)
6382 __pyx_v_self->format = __pyx_t_7;
6391 __Pyx_TraceLine(145,0,__PYX_ERR(2, 145, __pyx_L1_error))
6392 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
6401 __Pyx_TraceLine(146,0,__PYX_ERR(2, 146, __pyx_L1_error))
6402 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
6411 __Pyx_TraceLine(148,0,__PYX_ERR(2, 148, __pyx_L1_error))
6412 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
6413 if (unlikely(__pyx_t_4)) {
6422 __Pyx_TraceLine(149,0,__PYX_ERR(2, 149, __pyx_L1_error))
6423 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error)
6424 __Pyx_GOTREF(__pyx_t_3);
6425 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6426 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6427 __PYX_ERR(2, 149, __pyx_L1_error)
6445 __Pyx_TraceLine(152,0,__PYX_ERR(2, 152, __pyx_L1_error))
6447 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
6449 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
6450 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6451 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error)
6453 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error)
6454 __Pyx_GOTREF(__pyx_t_5);
6456 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error)
6457 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6458 __pyx_v_dim = __pyx_t_9;
6459 __pyx_v_idx = __pyx_t_8;
6460 __pyx_t_8 = (__pyx_t_8 + 1);
6469 __Pyx_TraceLine(153,0,__PYX_ERR(2, 153, __pyx_L1_error))
6470 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
6471 if (unlikely(__pyx_t_4)) {
6480 __Pyx_TraceLine(154,0,__PYX_ERR(2, 154, __pyx_L1_error))
6481 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error)
6482 __Pyx_GOTREF(__pyx_t_5);
6483 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error)
6484 __Pyx_GOTREF(__pyx_t_6);
6485 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error)
6486 __Pyx_GOTREF(__pyx_t_10);
6487 __Pyx_GIVEREF(__pyx_t_5);
6488 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
6489 __Pyx_GIVEREF(__pyx_t_6);
6490 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
6493 __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error)
6494 __Pyx_GOTREF(__pyx_t_6);
6495 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6496 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error)
6497 __Pyx_GOTREF(__pyx_t_10);
6498 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6499 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6500 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6501 __PYX_ERR(2, 154, __pyx_L1_error)
6519 __Pyx_TraceLine(155,0,__PYX_ERR(2, 155, __pyx_L1_error))
6520 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
6529 __Pyx_TraceLine(152,0,__PYX_ERR(2, 152, __pyx_L1_error))
6531 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6540 __Pyx_TraceLine(158,0,__PYX_ERR(2, 158, __pyx_L1_error))
6541 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error)
6551 __Pyx_TraceLine(159,0,__PYX_ERR(2, 159, __pyx_L1_error))
6552 __pyx_v_order =
'F';
6561 __Pyx_TraceLine(160,0,__PYX_ERR(2, 160, __pyx_L1_error))
6562 __Pyx_INCREF(__pyx_n_u_fortran);
6563 __Pyx_GIVEREF(__pyx_n_u_fortran);
6564 __Pyx_GOTREF(__pyx_v_self->mode);
6565 __Pyx_DECREF(__pyx_v_self->mode);
6566 __pyx_v_self->mode = __pyx_n_u_fortran;
6585 __Pyx_TraceLine(161,0,__PYX_ERR(2, 161, __pyx_L1_error))
6586 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error)
6587 if (likely(__pyx_t_4)) {
6596 __Pyx_TraceLine(162,0,__PYX_ERR(2, 162, __pyx_L1_error))
6597 __pyx_v_order =
'C';
6606 __Pyx_TraceLine(163,0,__PYX_ERR(2, 163, __pyx_L1_error))
6607 __Pyx_INCREF(__pyx_n_u_c);
6608 __Pyx_GIVEREF(__pyx_n_u_c);
6609 __Pyx_GOTREF(__pyx_v_self->mode);
6610 __Pyx_DECREF(__pyx_v_self->mode);
6611 __pyx_v_self->mode = __pyx_n_u_c;
6630 __Pyx_TraceLine(165,0,__PYX_ERR(2, 165, __pyx_L1_error))
6632 __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error)
6633 __Pyx_GOTREF(__pyx_t_3);
6634 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error)
6635 __Pyx_GOTREF(__pyx_t_10);
6636 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6637 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6638 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6639 __PYX_ERR(2, 165, __pyx_L1_error)
6650 __Pyx_TraceLine(167,0,__PYX_ERR(2, 167, __pyx_L1_error))
6651 __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
6660 __Pyx_TraceLine(170,0,__PYX_ERR(2, 170, __pyx_L1_error))
6661 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
6670 __Pyx_TraceLine(171,0,__PYX_ERR(2, 171, __pyx_L1_error))
6671 __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error)
6672 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error)
6673 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6674 __pyx_v_self->dtype_is_object = __pyx_t_4;
6683 __Pyx_TraceLine(172,0,__PYX_ERR(2, 172, __pyx_L1_error))
6684 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
6694 __Pyx_TraceLine(175,0,__PYX_ERR(2, 175, __pyx_L1_error))
6695 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
6704 __Pyx_TraceLine(176,0,__PYX_ERR(2, 176, __pyx_L1_error))
6705 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
6706 if (unlikely(__pyx_t_4)) {
6715 __Pyx_TraceLine(177,0,__PYX_ERR(2, 177, __pyx_L1_error))
6716 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error)
6717 __Pyx_GOTREF(__pyx_t_10);
6718 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6719 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6720 __PYX_ERR(2, 177, __pyx_L1_error)
6738 __Pyx_TraceLine(179,0,__PYX_ERR(2, 179, __pyx_L1_error))
6739 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
6749 __Pyx_TraceLine(180,0,__PYX_ERR(2, 180, __pyx_L1_error))
6750 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
6759 __Pyx_TraceLine(181,0,__PYX_ERR(2, 181, __pyx_L1_error))
6760 if (unlikely(__pyx_v_itemsize == 0)) {
6761 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
6762 __PYX_ERR(2, 181, __pyx_L1_error)
6764 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
6765 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
6766 __PYX_ERR(2, 181, __pyx_L1_error)
6768 __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
6769 __pyx_t_9 = __pyx_t_1;
6770 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
6771 __pyx_v_i = __pyx_t_11;
6780 __Pyx_TraceLine(182,0,__PYX_ERR(2, 182, __pyx_L1_error))
6781 (__pyx_v_p[__pyx_v_i]) = Py_None;
6790 __Pyx_TraceLine(183,0,__PYX_ERR(2, 183, __pyx_L1_error))
6824 __Pyx_XDECREF(__pyx_t_3);
6825 __Pyx_XDECREF(__pyx_t_5);
6826 __Pyx_XDECREF(__pyx_t_6);
6827 __Pyx_XDECREF(__pyx_t_10);
6828 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6831 __Pyx_XDECREF(__pyx_v_format);
6832 __Pyx_TraceReturn(Py_None, 0);
6833 __Pyx_RefNannyFinishContext();
6846 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
6847 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
6849 __Pyx_RefNannyDeclarations
6850 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
6851 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((
struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
6854 __Pyx_RefNannyFinishContext();
6858 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
6859 int __pyx_v_bufmode;
6861 __Pyx_TraceDeclarations
6862 __Pyx_RefNannyDeclarations
6865 PyObject *__pyx_t_3 = NULL;
6867 Py_ssize_t __pyx_t_5;
6869 Py_ssize_t *__pyx_t_7;
6870 int __pyx_lineno = 0;
6871 const char *__pyx_filename = NULL;
6872 int __pyx_clineno = 0;
6873 if (__pyx_v_info == NULL) {
6874 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
6877 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
6878 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
6879 __Pyx_GIVEREF(__pyx_v_info->obj);
6880 __Pyx_TraceCall(
"__getbuffer__", __pyx_f[2], 186, 0, __PYX_ERR(2, 186, __pyx_L1_error));
6889 __Pyx_TraceLine(187,0,__PYX_ERR(2, 187, __pyx_L1_error))
6890 __pyx_v_bufmode = -1;
6899 __Pyx_TraceLine(188,0,__PYX_ERR(2, 188, __pyx_L1_error))
6900 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error)
6901 __pyx_t_2 = (__pyx_t_1 != 0);
6911 __Pyx_TraceLine(189,0,__PYX_ERR(2, 189, __pyx_L1_error))
6912 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6931 __Pyx_TraceLine(190,0,__PYX_ERR(2, 190, __pyx_L1_error))
6932 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error)
6933 __pyx_t_1 = (__pyx_t_2 != 0);
6943 __Pyx_TraceLine(191,0,__PYX_ERR(2, 191, __pyx_L1_error))
6944 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6963 __Pyx_TraceLine(192,0,__PYX_ERR(2, 192, __pyx_L1_error))
6964 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
6965 if (unlikely(__pyx_t_1)) {
6974 __Pyx_TraceLine(193,0,__PYX_ERR(2, 193, __pyx_L1_error))
6975 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error)
6976 __Pyx_GOTREF(__pyx_t_3);
6977 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6978 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6979 __PYX_ERR(2, 193, __pyx_L1_error)
6997 __Pyx_TraceLine(194,0,__PYX_ERR(2, 194, __pyx_L1_error))
6998 __pyx_t_4 = __pyx_v_self->data;
6999 __pyx_v_info->buf = __pyx_t_4;
7008 __Pyx_TraceLine(195,0,__PYX_ERR(2, 195, __pyx_L1_error))
7009 __pyx_t_5 = __pyx_v_self->len;
7010 __pyx_v_info->len = __pyx_t_5;
7019 __Pyx_TraceLine(196,0,__PYX_ERR(2, 196, __pyx_L1_error))
7020 __pyx_t_6 = __pyx_v_self->ndim;
7021 __pyx_v_info->ndim = __pyx_t_6;
7030 __Pyx_TraceLine(197,0,__PYX_ERR(2, 197, __pyx_L1_error))
7031 __pyx_t_7 = __pyx_v_self->_shape;
7032 __pyx_v_info->shape = __pyx_t_7;
7041 __Pyx_TraceLine(198,0,__PYX_ERR(2, 198, __pyx_L1_error))
7042 __pyx_t_7 = __pyx_v_self->_strides;
7043 __pyx_v_info->strides = __pyx_t_7;
7052 __Pyx_TraceLine(199,0,__PYX_ERR(2, 199, __pyx_L1_error))
7053 __pyx_v_info->suboffsets = NULL;
7062 __Pyx_TraceLine(200,0,__PYX_ERR(2, 200, __pyx_L1_error))
7063 __pyx_t_5 = __pyx_v_self->itemsize;
7064 __pyx_v_info->itemsize = __pyx_t_5;
7073 __Pyx_TraceLine(201,0,__PYX_ERR(2, 201, __pyx_L1_error))
7074 __pyx_v_info->readonly = 0;
7083 __Pyx_TraceLine(203,0,__PYX_ERR(2, 203, __pyx_L1_error))
7084 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7094 __Pyx_TraceLine(204,0,__PYX_ERR(2, 204, __pyx_L1_error))
7095 __pyx_t_4 = __pyx_v_self->format;
7096 __pyx_v_info->format = __pyx_t_4;
7115 __Pyx_TraceLine(206,0,__PYX_ERR(2, 206, __pyx_L1_error))
7117 __pyx_v_info->format = NULL;
7128 __Pyx_TraceLine(208,0,__PYX_ERR(2, 208, __pyx_L1_error))
7129 __Pyx_INCREF(((PyObject *)__pyx_v_self));
7130 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7131 __Pyx_GOTREF(__pyx_v_info->obj);
7132 __Pyx_DECREF(__pyx_v_info->obj);
7133 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
7147 __Pyx_XDECREF(__pyx_t_3);
7148 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7150 if (__pyx_v_info->obj != NULL) {
7151 __Pyx_GOTREF(__pyx_v_info->obj);
7152 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7156 if (__pyx_v_info->obj == Py_None) {
7157 __Pyx_GOTREF(__pyx_v_info->obj);
7158 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7161 __Pyx_TraceReturn(Py_None, 0);
7162 __Pyx_RefNannyFinishContext();
7175 static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
7176 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
7177 __Pyx_RefNannyDeclarations
7178 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
7179 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
7182 __Pyx_RefNannyFinishContext();
7185 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
7186 __Pyx_TraceDeclarations
7187 __Pyx_RefNannyDeclarations
7189 int __pyx_lineno = 0;
7190 const char *__pyx_filename = NULL;
7191 int __pyx_clineno = 0;
7192 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
7193 __Pyx_TraceCall(
"__dealloc__", __pyx_f[2], 212, 0, __PYX_ERR(2, 212, __pyx_L1_error));
7202 __Pyx_TraceLine(213,0,__PYX_ERR(2, 213, __pyx_L1_error))
7203 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
7213 __Pyx_TraceLine(214,0,__PYX_ERR(2, 214, __pyx_L1_error))
7214 __pyx_v_self->callback_free_data(__pyx_v_self->data);
7233 __Pyx_TraceLine(215,0,__PYX_ERR(2, 215, __pyx_L1_error))
7234 __pyx_t_1 = (__pyx_v_self->free_data != 0);
7244 __Pyx_TraceLine(216,0,__PYX_ERR(2, 216, __pyx_L1_error))
7245 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
7255 __Pyx_TraceLine(217,0,__PYX_ERR(2, 217, __pyx_L1_error))
7256 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
7274 __Pyx_TraceLine(219,0,__PYX_ERR(2, 219, __pyx_L1_error))
7275 free(__pyx_v_self->data);
7294 __Pyx_TraceLine(220,0,__PYX_ERR(2, 220, __pyx_L1_error))
7295 PyObject_Free(__pyx_v_self->_shape);
7308 __Pyx_WriteUnraisable(
"View.MemoryView.array.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
7310 __Pyx_TraceReturn(Py_None, 0);
7311 __Pyx_RefNannyFinishContext();
7323 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
7324 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
7325 PyObject *__pyx_r = 0;
7326 __Pyx_RefNannyDeclarations
7327 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
7328 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
7331 __Pyx_RefNannyFinishContext();
7335 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
7336 PyObject *__pyx_r = NULL;
7337 __Pyx_TraceDeclarations
7338 __Pyx_RefNannyDeclarations
7339 PyObject *__pyx_t_1 = NULL;
7340 int __pyx_lineno = 0;
7341 const char *__pyx_filename = NULL;
7342 int __pyx_clineno = 0;
7343 __Pyx_RefNannySetupContext(
"__get__", 0);
7344 __Pyx_TraceCall(
"__get__", __pyx_f[2], 223, 0, __PYX_ERR(2, 223, __pyx_L1_error));
7353 __Pyx_TraceLine(224,0,__PYX_ERR(2, 224, __pyx_L1_error))
7354 __Pyx_XDECREF(__pyx_r);
7355 __pyx_t_1 = ((
struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error)
7356 __Pyx_GOTREF(__pyx_t_1);
7357 __pyx_r = __pyx_t_1;
7371 __Pyx_XDECREF(__pyx_t_1);
7372 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7375 __Pyx_XGIVEREF(__pyx_r);
7376 __Pyx_TraceReturn(__pyx_r, 0);
7377 __Pyx_RefNannyFinishContext();
7389 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
7391 PyObject *__pyx_r = NULL;
7392 __Pyx_TraceDeclarations
7393 __Pyx_RefNannyDeclarations
7394 PyObject *__pyx_t_1 = NULL;
7395 PyObject *__pyx_t_2 = NULL;
7396 PyObject *__pyx_t_3 = NULL;
7397 int __pyx_lineno = 0;
7398 const char *__pyx_filename = NULL;
7399 int __pyx_clineno = 0;
7400 __Pyx_RefNannySetupContext(
"get_memview", 0);
7401 __Pyx_TraceCall(
"get_memview", __pyx_f[2], 227, 0, __PYX_ERR(2, 227, __pyx_L1_error));
7410 __Pyx_TraceLine(228,0,__PYX_ERR(2, 228, __pyx_L1_error))
7411 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
7420 __Pyx_TraceLine(229,0,__PYX_ERR(2, 229, __pyx_L1_error))
7421 __Pyx_XDECREF(__pyx_r);
7422 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error)
7423 __Pyx_GOTREF(__pyx_t_1);
7424 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error)
7425 __Pyx_GOTREF(__pyx_t_2);
7426 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error)
7427 __Pyx_GOTREF(__pyx_t_3);
7428 __Pyx_INCREF(((PyObject *)__pyx_v_self));
7429 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7430 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
7431 __Pyx_GIVEREF(__pyx_t_1);
7432 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
7433 __Pyx_GIVEREF(__pyx_t_2);
7434 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
7437 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error)
7438 __Pyx_GOTREF(__pyx_t_2);
7439 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7440 __pyx_r = __pyx_t_2;
7454 __Pyx_XDECREF(__pyx_t_1);
7455 __Pyx_XDECREF(__pyx_t_2);
7456 __Pyx_XDECREF(__pyx_t_3);
7457 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
7460 __Pyx_XGIVEREF(__pyx_r);
7461 __Pyx_TraceReturn(__pyx_r, 0);
7462 __Pyx_RefNannyFinishContext();
7475 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
7476 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
7478 __Pyx_RefNannyDeclarations
7479 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
7480 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
7483 __Pyx_RefNannyFinishContext();
7487 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
7489 __Pyx_TraceDeclarations
7490 __Pyx_RefNannyDeclarations
7491 int __pyx_lineno = 0;
7492 const char *__pyx_filename = NULL;
7493 int __pyx_clineno = 0;
7494 __Pyx_RefNannySetupContext(
"__len__", 0);
7495 __Pyx_TraceCall(
"__len__", __pyx_f[2], 231, 0, __PYX_ERR(2, 231, __pyx_L1_error));
7504 __Pyx_TraceLine(232,0,__PYX_ERR(2, 232, __pyx_L1_error))
7505 __pyx_r = (__pyx_v_self->_shape[0]);
7518 __Pyx_AddTraceback(
"View.MemoryView.array.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7521 __Pyx_TraceReturn(Py_None, 0);
7522 __Pyx_RefNannyFinishContext();
7535 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
7536 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
7537 PyObject *__pyx_r = 0;
7538 __Pyx_RefNannyDeclarations
7539 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
7540 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
7543 __Pyx_RefNannyFinishContext();
7547 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
7548 PyObject *__pyx_r = NULL;
7549 __Pyx_TraceDeclarations
7550 __Pyx_RefNannyDeclarations
7551 PyObject *__pyx_t_1 = NULL;
7552 PyObject *__pyx_t_2 = NULL;
7553 int __pyx_lineno = 0;
7554 const char *__pyx_filename = NULL;
7555 int __pyx_clineno = 0;
7556 __Pyx_RefNannySetupContext(
"__getattr__", 0);
7557 __Pyx_TraceCall(
"__getattr__", __pyx_f[2], 234, 0, __PYX_ERR(2, 234, __pyx_L1_error));
7566 __Pyx_TraceLine(235,0,__PYX_ERR(2, 235, __pyx_L1_error))
7567 __Pyx_XDECREF(__pyx_r);
7568 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error)
7569 __Pyx_GOTREF(__pyx_t_1);
7570 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error)
7571 __Pyx_GOTREF(__pyx_t_2);
7572 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7573 __pyx_r = __pyx_t_2;
7587 __Pyx_XDECREF(__pyx_t_1);
7588 __Pyx_XDECREF(__pyx_t_2);
7589 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7592 __Pyx_XGIVEREF(__pyx_r);
7593 __Pyx_TraceReturn(__pyx_r, 0);
7594 __Pyx_RefNannyFinishContext();
7607 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
7608 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
7609 PyObject *__pyx_r = 0;
7610 __Pyx_RefNannyDeclarations
7611 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
7612 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
7615 __Pyx_RefNannyFinishContext();
7619 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
7620 PyObject *__pyx_r = NULL;
7621 __Pyx_TraceDeclarations
7622 __Pyx_RefNannyDeclarations
7623 PyObject *__pyx_t_1 = NULL;
7624 PyObject *__pyx_t_2 = NULL;
7625 int __pyx_lineno = 0;
7626 const char *__pyx_filename = NULL;
7627 int __pyx_clineno = 0;
7628 __Pyx_RefNannySetupContext(
"__getitem__", 0);
7629 __Pyx_TraceCall(
"__getitem__", __pyx_f[2], 237, 0, __PYX_ERR(2, 237, __pyx_L1_error));
7638 __Pyx_TraceLine(238,0,__PYX_ERR(2, 238, __pyx_L1_error))
7639 __Pyx_XDECREF(__pyx_r);
7640 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error)
7641 __Pyx_GOTREF(__pyx_t_1);
7642 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error)
7643 __Pyx_GOTREF(__pyx_t_2);
7644 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7645 __pyx_r = __pyx_t_2;
7659 __Pyx_XDECREF(__pyx_t_1);
7660 __Pyx_XDECREF(__pyx_t_2);
7661 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7664 __Pyx_XGIVEREF(__pyx_r);
7665 __Pyx_TraceReturn(__pyx_r, 0);
7666 __Pyx_RefNannyFinishContext();
7679 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
7680 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
7682 __Pyx_RefNannyDeclarations
7683 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
7684 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
7687 __Pyx_RefNannyFinishContext();
7691 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
7693 __Pyx_TraceDeclarations
7694 __Pyx_RefNannyDeclarations
7695 PyObject *__pyx_t_1 = NULL;
7696 int __pyx_lineno = 0;
7697 const char *__pyx_filename = NULL;
7698 int __pyx_clineno = 0;
7699 __Pyx_RefNannySetupContext(
"__setitem__", 0);
7700 __Pyx_TraceCall(
"__setitem__", __pyx_f[2], 240, 0, __PYX_ERR(2, 240, __pyx_L1_error));
7709 __Pyx_TraceLine(241,0,__PYX_ERR(2, 241, __pyx_L1_error))
7710 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error)
7711 __Pyx_GOTREF(__pyx_t_1);
7712 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error)
7713 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7727 __Pyx_XDECREF(__pyx_t_1);
7728 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7731 __Pyx_TraceReturn(Py_None, 0);
7732 __Pyx_RefNannyFinishContext();
7743 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
7744 static PyMethodDef __pyx_mdef___pyx_array_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0};
7745 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7746 PyObject *__pyx_r = 0;
7747 __Pyx_RefNannyDeclarations
7748 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
7749 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
7752 __Pyx_RefNannyFinishContext();
7756 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
7757 PyObject *__pyx_r = NULL;
7758 __Pyx_TraceDeclarations
7759 __Pyx_RefNannyDeclarations
7760 PyObject *__pyx_t_1 = NULL;
7761 int __pyx_lineno = 0;
7762 const char *__pyx_filename = NULL;
7763 int __pyx_clineno = 0;
7764 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
7765 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
7773 __Pyx_TraceLine(2,0,__PYX_ERR(2, 2, __pyx_L1_error))
7774 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
7775 __Pyx_GOTREF(__pyx_t_1);
7776 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7777 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7778 __PYX_ERR(2, 2, __pyx_L1_error)
7788 __Pyx_XDECREF(__pyx_t_1);
7789 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7791 __Pyx_XGIVEREF(__pyx_r);
7792 __Pyx_TraceReturn(__pyx_r, 0);
7793 __Pyx_RefNannyFinishContext();
7805 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
7806 static PyMethodDef __pyx_mdef___pyx_array_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0};
7807 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7808 PyObject *__pyx_r = 0;
7809 __Pyx_RefNannyDeclarations
7810 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
7811 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
7814 __Pyx_RefNannyFinishContext();
7818 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
7819 PyObject *__pyx_r = NULL;
7820 __Pyx_TraceDeclarations
7821 __Pyx_RefNannyDeclarations
7822 PyObject *__pyx_t_1 = NULL;
7823 int __pyx_lineno = 0;
7824 const char *__pyx_filename = NULL;
7825 int __pyx_clineno = 0;
7826 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
7827 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[2], 3, 0, __PYX_ERR(2, 3, __pyx_L1_error));
7834 __Pyx_TraceLine(4,0,__PYX_ERR(2, 4, __pyx_L1_error))
7835 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
7836 __Pyx_GOTREF(__pyx_t_1);
7837 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7838 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7839 __PYX_ERR(2, 4, __pyx_L1_error)
7850 __Pyx_XDECREF(__pyx_t_1);
7851 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7853 __Pyx_XGIVEREF(__pyx_r);
7854 __Pyx_TraceReturn(__pyx_r, 0);
7855 __Pyx_RefNannyFinishContext();
7867 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize,
char *__pyx_v_format,
char *__pyx_v_mode,
char *__pyx_v_buf) {
7868 struct __pyx_array_obj *__pyx_v_result = 0;
7869 struct __pyx_array_obj *__pyx_r = NULL;
7870 __Pyx_TraceDeclarations
7871 __Pyx_RefNannyDeclarations
7873 PyObject *__pyx_t_2 = NULL;
7874 PyObject *__pyx_t_3 = NULL;
7875 PyObject *__pyx_t_4 = NULL;
7876 PyObject *__pyx_t_5 = NULL;
7877 int __pyx_lineno = 0;
7878 const char *__pyx_filename = NULL;
7879 int __pyx_clineno = 0;
7880 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
7881 __Pyx_TraceCall(
"array_cwrapper", __pyx_f[2], 245, 0, __PYX_ERR(2, 245, __pyx_L1_error));
7890 __Pyx_TraceLine(249,0,__PYX_ERR(2, 249, __pyx_L1_error))
7891 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
7901 __Pyx_TraceLine(250,0,__PYX_ERR(2, 250, __pyx_L1_error))
7902 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error)
7903 __Pyx_GOTREF(__pyx_t_2);
7904 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error)
7905 __Pyx_GOTREF(__pyx_t_3);
7906 __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error)
7907 __Pyx_GOTREF(__pyx_t_4);
7908 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error)
7909 __Pyx_GOTREF(__pyx_t_5);
7910 __Pyx_INCREF(__pyx_v_shape);
7911 __Pyx_GIVEREF(__pyx_v_shape);
7912 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
7913 __Pyx_GIVEREF(__pyx_t_2);
7914 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
7915 __Pyx_GIVEREF(__pyx_t_3);
7916 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
7917 __Pyx_GIVEREF(__pyx_t_4);
7918 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
7922 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error)
7923 __Pyx_GOTREF(__pyx_t_4);
7924 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7925 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
7945 __Pyx_TraceLine(252,0,__PYX_ERR(2, 252, __pyx_L1_error))
7947 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error)
7948 __Pyx_GOTREF(__pyx_t_4);
7949 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error)
7950 __Pyx_GOTREF(__pyx_t_5);
7951 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
7952 __Pyx_GOTREF(__pyx_t_3);
7953 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error)
7954 __Pyx_GOTREF(__pyx_t_2);
7955 __Pyx_INCREF(__pyx_v_shape);
7956 __Pyx_GIVEREF(__pyx_v_shape);
7957 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
7958 __Pyx_GIVEREF(__pyx_t_4);
7959 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
7960 __Pyx_GIVEREF(__pyx_t_5);
7961 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
7962 __Pyx_GIVEREF(__pyx_t_3);
7963 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
7975 __Pyx_TraceLine(253,0,__PYX_ERR(2, 253, __pyx_L1_error))
7976 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error)
7977 __Pyx_GOTREF(__pyx_t_3);
7978 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error)
7987 __Pyx_TraceLine(252,0,__PYX_ERR(2, 252, __pyx_L1_error))
7988 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error)
7989 __Pyx_GOTREF(__pyx_t_5);
7990 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7991 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7992 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
8002 __Pyx_TraceLine(254,0,__PYX_ERR(2, 254, __pyx_L1_error))
8003 __pyx_v_result->data = __pyx_v_buf;
8014 __Pyx_TraceLine(256,0,__PYX_ERR(2, 256, __pyx_L1_error))
8015 __Pyx_XDECREF(((PyObject *)__pyx_r));
8016 __Pyx_INCREF(((PyObject *)__pyx_v_result));
8017 __pyx_r = __pyx_v_result;
8030 __Pyx_XDECREF(__pyx_t_2);
8031 __Pyx_XDECREF(__pyx_t_3);
8032 __Pyx_XDECREF(__pyx_t_4);
8033 __Pyx_XDECREF(__pyx_t_5);
8034 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8037 __Pyx_XDECREF((PyObject *)__pyx_v_result);
8038 __Pyx_XGIVEREF((PyObject *)__pyx_r);
8039 __Pyx_TraceReturn(__pyx_r, 0);
8040 __Pyx_RefNannyFinishContext();
8053 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
8054 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8055 PyObject *__pyx_v_name = 0;
8056 int __pyx_lineno = 0;
8057 const char *__pyx_filename = NULL;
8058 int __pyx_clineno = 0;
8060 __Pyx_RefNannyDeclarations
8061 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
8063 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
8064 PyObject* values[1] = {0};
8065 if (unlikely(__pyx_kwds)) {
8067 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8069 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8072 default:
goto __pyx_L5_argtuple_error;
8074 kw_args = PyDict_Size(__pyx_kwds);
8077 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
8078 else goto __pyx_L5_argtuple_error;
8080 if (unlikely(kw_args > 0)) {
8081 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error)
8083 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
8084 goto __pyx_L5_argtuple_error;
8086 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8088 __pyx_v_name = values[0];
8090 goto __pyx_L4_argument_unpacking_done;
8091 __pyx_L5_argtuple_error:;
8092 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error)
8094 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8095 __Pyx_RefNannyFinishContext();
8097 __pyx_L4_argument_unpacking_done:;
8098 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
8101 __Pyx_RefNannyFinishContext();
8105 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
8107 __Pyx_TraceDeclarations
8108 __Pyx_RefNannyDeclarations
8109 int __pyx_lineno = 0;
8110 const char *__pyx_filename = NULL;
8111 int __pyx_clineno = 0;
8112 __Pyx_RefNannySetupContext(
"__init__", 0);
8113 __Pyx_TraceCall(
"__init__", __pyx_f[2], 282, 0, __PYX_ERR(2, 282, __pyx_L1_error));
8122 __Pyx_TraceLine(283,0,__PYX_ERR(2, 283, __pyx_L1_error))
8123 __Pyx_INCREF(__pyx_v_name);
8124 __Pyx_GIVEREF(__pyx_v_name);
8125 __Pyx_GOTREF(__pyx_v_self->name);
8126 __Pyx_DECREF(__pyx_v_self->name);
8127 __pyx_v_self->name = __pyx_v_name;
8141 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8144 __Pyx_TraceReturn(Py_None, 0);
8145 __Pyx_RefNannyFinishContext();
8158 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
8159 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
8160 PyObject *__pyx_r = 0;
8161 __Pyx_RefNannyDeclarations
8162 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
8163 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
8166 __Pyx_RefNannyFinishContext();
8170 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
8171 PyObject *__pyx_r = NULL;
8172 __Pyx_TraceDeclarations
8173 __Pyx_RefNannyDeclarations
8174 int __pyx_lineno = 0;
8175 const char *__pyx_filename = NULL;
8176 int __pyx_clineno = 0;
8177 __Pyx_RefNannySetupContext(
"__repr__", 0);
8178 __Pyx_TraceCall(
"__repr__", __pyx_f[2], 284, 0, __PYX_ERR(2, 284, __pyx_L1_error));
8187 __Pyx_TraceLine(285,0,__PYX_ERR(2, 285, __pyx_L1_error))
8188 __Pyx_XDECREF(__pyx_r);
8189 __Pyx_INCREF(__pyx_v_self->name);
8190 __pyx_r = __pyx_v_self->name;
8203 __Pyx_AddTraceback(
"View.MemoryView.Enum.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8206 __Pyx_XGIVEREF(__pyx_r);
8207 __Pyx_TraceReturn(__pyx_r, 0);
8208 __Pyx_RefNannyFinishContext();
8219 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
8220 static PyMethodDef __pyx_mdef___pyx_MemviewEnum_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0};
8221 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8222 PyObject *__pyx_r = 0;
8223 __Pyx_RefNannyDeclarations
8224 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
8225 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
8228 __Pyx_RefNannyFinishContext();
8232 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
8233 PyObject *__pyx_v_state = 0;
8234 PyObject *__pyx_v__dict = 0;
8235 int __pyx_v_use_setstate;
8236 PyObject *__pyx_r = NULL;
8237 __Pyx_TraceDeclarations
8238 __Pyx_RefNannyDeclarations
8239 PyObject *__pyx_t_1 = NULL;
8242 PyObject *__pyx_t_4 = NULL;
8243 PyObject *__pyx_t_5 = NULL;
8244 int __pyx_lineno = 0;
8245 const char *__pyx_filename = NULL;
8246 int __pyx_clineno = 0;
8247 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
8248 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
8257 __Pyx_TraceLine(5,0,__PYX_ERR(2, 5, __pyx_L1_error))
8258 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
8259 __Pyx_GOTREF(__pyx_t_1);
8260 __Pyx_INCREF(__pyx_v_self->name);
8261 __Pyx_GIVEREF(__pyx_v_self->name);
8262 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
8263 __pyx_v_state = ((PyObject*)__pyx_t_1);
8273 __Pyx_TraceLine(6,0,__PYX_ERR(2, 6, __pyx_L1_error))
8274 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
8275 __Pyx_GOTREF(__pyx_t_1);
8276 __pyx_v__dict = __pyx_t_1;
8286 __Pyx_TraceLine(7,0,__PYX_ERR(2, 7, __pyx_L1_error))
8287 __pyx_t_2 = (__pyx_v__dict != Py_None);
8288 __pyx_t_3 = (__pyx_t_2 != 0);
8298 __Pyx_TraceLine(8,0,__PYX_ERR(2, 8, __pyx_L1_error))
8299 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
8300 __Pyx_GOTREF(__pyx_t_1);
8301 __Pyx_INCREF(__pyx_v__dict);
8302 __Pyx_GIVEREF(__pyx_v__dict);
8303 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
8304 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
8305 __Pyx_GOTREF(__pyx_t_4);
8306 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8307 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
8317 __Pyx_TraceLine(9,0,__PYX_ERR(2, 9, __pyx_L1_error))
8318 __pyx_v_use_setstate = 1;
8337 __Pyx_TraceLine(11,0,__PYX_ERR(2, 11, __pyx_L1_error))
8339 __pyx_t_3 = (__pyx_v_self->name != Py_None);
8340 __pyx_v_use_setstate = __pyx_t_3;
8351 __Pyx_TraceLine(12,0,__PYX_ERR(2, 12, __pyx_L1_error))
8352 __pyx_t_3 = (__pyx_v_use_setstate != 0);
8362 __Pyx_TraceLine(13,0,__PYX_ERR(2, 13, __pyx_L1_error))
8363 __Pyx_XDECREF(__pyx_r);
8364 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
8365 __Pyx_GOTREF(__pyx_t_4);
8366 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
8367 __Pyx_GOTREF(__pyx_t_1);
8368 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8369 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8370 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8371 __Pyx_INCREF(__pyx_int_184977713);
8372 __Pyx_GIVEREF(__pyx_int_184977713);
8373 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
8374 __Pyx_INCREF(Py_None);
8375 __Pyx_GIVEREF(Py_None);
8376 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
8377 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
8378 __Pyx_GOTREF(__pyx_t_5);
8379 __Pyx_GIVEREF(__pyx_t_4);
8380 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
8381 __Pyx_GIVEREF(__pyx_t_1);
8382 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
8383 __Pyx_INCREF(__pyx_v_state);
8384 __Pyx_GIVEREF(__pyx_v_state);
8385 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
8388 __pyx_r = __pyx_t_5;
8408 __Pyx_TraceLine(15,0,__PYX_ERR(2, 15, __pyx_L1_error))
8410 __Pyx_XDECREF(__pyx_r);
8411 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
8412 __Pyx_GOTREF(__pyx_t_5);
8413 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
8414 __Pyx_GOTREF(__pyx_t_1);
8415 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8416 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8417 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8418 __Pyx_INCREF(__pyx_int_184977713);
8419 __Pyx_GIVEREF(__pyx_int_184977713);
8420 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
8421 __Pyx_INCREF(__pyx_v_state);
8422 __Pyx_GIVEREF(__pyx_v_state);
8423 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
8424 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
8425 __Pyx_GOTREF(__pyx_t_4);
8426 __Pyx_GIVEREF(__pyx_t_5);
8427 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
8428 __Pyx_GIVEREF(__pyx_t_1);
8429 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
8432 __pyx_r = __pyx_t_4;
8445 __Pyx_XDECREF(__pyx_t_1);
8446 __Pyx_XDECREF(__pyx_t_4);
8447 __Pyx_XDECREF(__pyx_t_5);
8448 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8451 __Pyx_XDECREF(__pyx_v_state);
8452 __Pyx_XDECREF(__pyx_v__dict);
8453 __Pyx_XGIVEREF(__pyx_r);
8454 __Pyx_TraceReturn(__pyx_r, 0);
8455 __Pyx_RefNannyFinishContext();
8467 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
8468 static PyMethodDef __pyx_mdef___pyx_MemviewEnum_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0};
8469 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8470 PyObject *__pyx_r = 0;
8471 __Pyx_RefNannyDeclarations
8472 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
8473 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8476 __Pyx_RefNannyFinishContext();
8480 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8481 PyObject *__pyx_r = NULL;
8482 __Pyx_TraceDeclarations
8483 __Pyx_RefNannyDeclarations
8484 PyObject *__pyx_t_1 = NULL;
8485 int __pyx_lineno = 0;
8486 const char *__pyx_filename = NULL;
8487 int __pyx_clineno = 0;
8488 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
8489 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[2], 16, 0, __PYX_ERR(2, 16, __pyx_L1_error));
8496 __Pyx_TraceLine(17,0,__PYX_ERR(2, 17, __pyx_L1_error))
8497 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
8498 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
8499 __Pyx_GOTREF(__pyx_t_1);
8500 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8510 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8513 __Pyx_XDECREF(__pyx_t_1);
8514 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8517 __Pyx_XGIVEREF(__pyx_r);
8518 __Pyx_TraceReturn(__pyx_r, 0);
8519 __Pyx_RefNannyFinishContext();
8531 static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
8532 Py_intptr_t __pyx_v_aligned_p;
8533 size_t __pyx_v_offset;
8535 __Pyx_TraceDeclarations
8537 int __pyx_lineno = 0;
8538 const char *__pyx_filename = NULL;
8539 int __pyx_clineno = 0;
8540 __Pyx_TraceCall(
"align_pointer", __pyx_f[2], 299, 1, __PYX_ERR(2, 299, __pyx_L1_error));
8549 __Pyx_TraceLine(301,1,__PYX_ERR(2, 301, __pyx_L1_error))
8550 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
8559 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
8568 __Pyx_TraceLine(307,1,__PYX_ERR(2, 307, __pyx_L1_error))
8569 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
8579 __Pyx_TraceLine(308,1,__PYX_ERR(2, 308, __pyx_L1_error))
8580 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
8598 __Pyx_TraceLine(310,1,__PYX_ERR(2, 310, __pyx_L1_error))
8599 __pyx_r = ((
void *)__pyx_v_aligned_p);
8612 __Pyx_WriteUnraisable(
"View.MemoryView.align_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
8615 __Pyx_TraceReturn(Py_None, 1);
8628 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
8629 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8630 PyObject *__pyx_v_obj = 0;
8632 int __pyx_v_dtype_is_object;
8633 int __pyx_lineno = 0;
8634 const char *__pyx_filename = NULL;
8635 int __pyx_clineno = 0;
8637 __Pyx_RefNannyDeclarations
8638 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
8640 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
8641 PyObject* values[3] = {0,0,0};
8642 if (unlikely(__pyx_kwds)) {
8644 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8646 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8648 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8650 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8653 default:
goto __pyx_L5_argtuple_error;
8655 kw_args = PyDict_Size(__pyx_kwds);
8658 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
8659 else goto __pyx_L5_argtuple_error;
8662 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
8664 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error)
8669 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
8670 if (value) { values[2] = value; kw_args--; }
8673 if (unlikely(kw_args > 0)) {
8674 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error)
8677 switch (PyTuple_GET_SIZE(__pyx_args)) {
8678 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8680 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8681 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8683 default:
goto __pyx_L5_argtuple_error;
8686 __pyx_v_obj = values[0];
8687 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_flags == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error)
8689 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]);
if (unlikely((__pyx_v_dtype_is_object == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error)
8691 __pyx_v_dtype_is_object = ((int)0);
8694 goto __pyx_L4_argument_unpacking_done;
8695 __pyx_L5_argtuple_error:;
8696 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error)
8698 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8699 __Pyx_RefNannyFinishContext();
8701 __pyx_L4_argument_unpacking_done:;
8702 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
8705 __Pyx_RefNannyFinishContext();
8709 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object) {
8711 __Pyx_TraceDeclarations
8712 __Pyx_RefNannyDeclarations
8717 int __pyx_lineno = 0;
8718 const char *__pyx_filename = NULL;
8719 int __pyx_clineno = 0;
8720 __Pyx_RefNannySetupContext(
"__cinit__", 0);
8721 __Pyx_TraceCall(
"__cinit__", __pyx_f[2], 346, 0, __PYX_ERR(2, 346, __pyx_L1_error));
8730 __Pyx_TraceLine(347,0,__PYX_ERR(2, 347, __pyx_L1_error))
8731 __Pyx_INCREF(__pyx_v_obj);
8732 __Pyx_GIVEREF(__pyx_v_obj);
8733 __Pyx_GOTREF(__pyx_v_self->obj);
8734 __Pyx_DECREF(__pyx_v_self->obj);
8735 __pyx_v_self->obj = __pyx_v_obj;
8744 __Pyx_TraceLine(348,0,__PYX_ERR(2, 348, __pyx_L1_error))
8745 __pyx_v_self->flags = __pyx_v_flags;
8754 __Pyx_TraceLine(349,0,__PYX_ERR(2, 349, __pyx_L1_error))
8755 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
8756 __pyx_t_3 = (__pyx_t_2 != 0);
8759 __pyx_t_1 = __pyx_t_3;
8760 goto __pyx_L4_bool_binop_done;
8762 __pyx_t_3 = (__pyx_v_obj != Py_None);
8763 __pyx_t_2 = (__pyx_t_3 != 0);
8764 __pyx_t_1 = __pyx_t_2;
8765 __pyx_L4_bool_binop_done:;
8775 __Pyx_TraceLine(350,0,__PYX_ERR(2, 350, __pyx_L1_error))
8776 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 350, __pyx_L1_error)
8785 __Pyx_TraceLine(351,0,__PYX_ERR(2, 351, __pyx_L1_error))
8786 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
8796 __Pyx_TraceLine(352,0,__PYX_ERR(2, 352, __pyx_L1_error))
8797 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
8806 __Pyx_TraceLine(353,0,__PYX_ERR(2, 353, __pyx_L1_error))
8834 __Pyx_TraceLine(355,0,__PYX_ERR(2, 355, __pyx_L1_error))
8835 __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0);
8845 __Pyx_TraceLine(357,0,__PYX_ERR(2, 357, __pyx_L1_error))
8846 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
8856 __Pyx_TraceLine(358,0,__PYX_ERR(2, 358, __pyx_L1_error))
8857 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
8866 __Pyx_TraceLine(359,0,__PYX_ERR(2, 359, __pyx_L1_error))
8867 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
8885 __Pyx_TraceLine(360,0,__PYX_ERR(2, 360, __pyx_L1_error))
8886 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
8896 __Pyx_TraceLine(361,0,__PYX_ERR(2, 361, __pyx_L1_error))
8897 __pyx_v_self->lock = PyThread_allocate_lock();
8906 __Pyx_TraceLine(362,0,__PYX_ERR(2, 362, __pyx_L1_error))
8907 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
8908 if (unlikely(__pyx_t_1)) {
8917 __Pyx_TraceLine(363,0,__PYX_ERR(2, 363, __pyx_L1_error))
8918 PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error)
8954 __Pyx_TraceLine(365,0,__PYX_ERR(2, 365, __pyx_L1_error))
8955 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
8965 __Pyx_TraceLine(366,0,__PYX_ERR(2, 366, __pyx_L1_error))
8966 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
8969 __pyx_t_1 = __pyx_t_2;
8970 goto __pyx_L12_bool_binop_done;
8972 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
8973 __pyx_t_1 = __pyx_t_2;
8974 __pyx_L12_bool_binop_done:;
8975 __pyx_v_self->dtype_is_object = __pyx_t_1;
8994 __Pyx_TraceLine(368,0,__PYX_ERR(2, 368, __pyx_L1_error))
8996 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
9007 __Pyx_TraceLine(370,0,__PYX_ERR(2, 370, __pyx_L1_error))
9008 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
9017 __Pyx_TraceLine(372,0,__PYX_ERR(2, 372, __pyx_L1_error))
9018 __pyx_v_self->typeinfo = NULL;
9032 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9035 __Pyx_TraceReturn(Py_None, 0);
9036 __Pyx_RefNannyFinishContext();
9049 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
9050 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
9051 __Pyx_RefNannyDeclarations
9052 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
9053 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
9056 __Pyx_RefNannyFinishContext();
9059 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
9061 __Pyx_TraceDeclarations
9062 __Pyx_RefNannyDeclarations
9068 PyThread_type_lock __pyx_t_6;
9069 PyThread_type_lock __pyx_t_7;
9070 int __pyx_lineno = 0;
9071 const char *__pyx_filename = NULL;
9072 int __pyx_clineno = 0;
9073 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
9074 __Pyx_TraceCall(
"__dealloc__", __pyx_f[2], 374, 0, __PYX_ERR(2, 374, __pyx_L1_error));
9083 __Pyx_TraceLine(375,0,__PYX_ERR(2, 375, __pyx_L1_error))
9084 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
9085 __pyx_t_2 = (__pyx_t_1 != 0);
9095 __Pyx_TraceLine(376,0,__PYX_ERR(2, 376, __pyx_L1_error))
9096 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
9115 __Pyx_TraceLine(377,0,__PYX_ERR(2, 377, __pyx_L1_error))
9116 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
9126 __Pyx_TraceLine(379,0,__PYX_ERR(2, 379, __pyx_L1_error))
9127 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
9136 __Pyx_TraceLine(380,0,__PYX_ERR(2, 380, __pyx_L1_error))
9156 __Pyx_TraceLine(384,0,__PYX_ERR(2, 384, __pyx_L1_error))
9157 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
9167 __Pyx_TraceLine(385,0,__PYX_ERR(2, 385, __pyx_L1_error))
9168 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
9169 __pyx_t_4 = __pyx_t_3;
9170 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
9171 __pyx_v_i = __pyx_t_5;
9180 __Pyx_TraceLine(386,0,__PYX_ERR(2, 386, __pyx_L1_error))
9181 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
9191 __Pyx_TraceLine(387,0,__PYX_ERR(2, 387, __pyx_L1_error))
9192 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
9201 __Pyx_TraceLine(388,0,__PYX_ERR(2, 388, __pyx_L1_error))
9202 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
9212 __Pyx_TraceLine(390,0,__PYX_ERR(2, 390, __pyx_L1_error))
9213 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9214 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
9223 __Pyx_TraceLine(389,0,__PYX_ERR(2, 389, __pyx_L1_error))
9224 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
9225 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
9243 __Pyx_TraceLine(391,0,__PYX_ERR(2, 391, __pyx_L1_error))
9244 goto __pyx_L6_break;
9264 __Pyx_TraceLine(393,0,__PYX_ERR(2, 393, __pyx_L1_error))
9265 PyThread_free_lock(__pyx_v_self->lock);
9289 __Pyx_WriteUnraisable(
"View.MemoryView.memoryview.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
9291 __Pyx_TraceReturn(Py_None, 0);
9292 __Pyx_RefNannyFinishContext();
9303 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
9304 Py_ssize_t __pyx_v_dim;
9305 char *__pyx_v_itemp;
9306 PyObject *__pyx_v_idx = NULL;
9308 __Pyx_TraceDeclarations
9309 __Pyx_RefNannyDeclarations
9310 Py_ssize_t __pyx_t_1;
9311 PyObject *__pyx_t_2 = NULL;
9312 Py_ssize_t __pyx_t_3;
9313 PyObject *(*__pyx_t_4)(PyObject *);
9314 PyObject *__pyx_t_5 = NULL;
9315 Py_ssize_t __pyx_t_6;
9317 int __pyx_lineno = 0;
9318 const char *__pyx_filename = NULL;
9319 int __pyx_clineno = 0;
9320 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
9321 __Pyx_TraceCall(
"get_item_pointer", __pyx_f[2], 395, 0, __PYX_ERR(2, 395, __pyx_L1_error));
9330 __Pyx_TraceLine(397,0,__PYX_ERR(2, 397, __pyx_L1_error))
9331 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
9340 __Pyx_TraceLine(399,0,__PYX_ERR(2, 399, __pyx_L1_error))
9342 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
9343 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
9346 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error)
9347 __Pyx_GOTREF(__pyx_t_2);
9348 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error)
9351 if (likely(!__pyx_t_4)) {
9352 if (likely(PyList_CheckExact(__pyx_t_2))) {
9353 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
9354 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9355 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error)
9357 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error)
9358 __Pyx_GOTREF(__pyx_t_5);
9361 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
9362 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9363 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error)
9365 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error)
9366 __Pyx_GOTREF(__pyx_t_5);
9370 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
9371 if (unlikely(!__pyx_t_5)) {
9372 PyObject* exc_type = PyErr_Occurred();
9374 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9375 else __PYX_ERR(2, 399, __pyx_L1_error)
9379 __Pyx_GOTREF(__pyx_t_5);
9381 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
9383 __pyx_v_dim = __pyx_t_1;
9384 __pyx_t_1 = (__pyx_t_1 + 1);
9393 __Pyx_TraceLine(400,0,__PYX_ERR(2, 400, __pyx_L1_error))
9394 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx);
if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error)
9395 __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim);
if (unlikely(__pyx_t_7 == ((
char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error)
9396 __pyx_v_itemp = __pyx_t_7;
9405 __Pyx_TraceLine(399,0,__PYX_ERR(2, 399, __pyx_L1_error))
9407 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9416 __Pyx_TraceLine(402,0,__PYX_ERR(2, 402, __pyx_L1_error))
9417 __pyx_r = __pyx_v_itemp;
9430 __Pyx_XDECREF(__pyx_t_2);
9431 __Pyx_XDECREF(__pyx_t_5);
9432 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
9435 __Pyx_XDECREF(__pyx_v_idx);
9436 __Pyx_TraceReturn(Py_None, 0);
9437 __Pyx_RefNannyFinishContext();
9450 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
9451 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
9452 PyObject *__pyx_r = 0;
9453 __Pyx_RefNannyDeclarations
9454 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
9455 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
9458 __Pyx_RefNannyFinishContext();
9462 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
9463 PyObject *__pyx_v_have_slices = NULL;
9464 PyObject *__pyx_v_indices = NULL;
9465 char *__pyx_v_itemp;
9466 PyObject *__pyx_r = NULL;
9467 __Pyx_TraceDeclarations
9468 __Pyx_RefNannyDeclarations
9471 PyObject *__pyx_t_3 = NULL;
9472 PyObject *__pyx_t_4 = NULL;
9473 PyObject *__pyx_t_5 = NULL;
9475 int __pyx_lineno = 0;
9476 const char *__pyx_filename = NULL;
9477 int __pyx_clineno = 0;
9478 __Pyx_RefNannySetupContext(
"__getitem__", 0);
9479 __Pyx_TraceCall(
"__getitem__", __pyx_f[2], 405, 0, __PYX_ERR(2, 405, __pyx_L1_error));
9488 __Pyx_TraceLine(406,0,__PYX_ERR(2, 406, __pyx_L1_error))
9489 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
9490 __pyx_t_2 = (__pyx_t_1 != 0);
9500 __Pyx_TraceLine(407,0,__PYX_ERR(2, 407, __pyx_L1_error))
9501 __Pyx_XDECREF(__pyx_r);
9502 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9503 __pyx_r = ((PyObject *)__pyx_v_self);
9522 __Pyx_TraceLine(409,0,__PYX_ERR(2, 409, __pyx_L1_error))
9523 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error)
9524 __Pyx_GOTREF(__pyx_t_3);
9525 if (likely(__pyx_t_3 != Py_None)) {
9526 PyObject* sequence = __pyx_t_3;
9527 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9528 if (unlikely(size != 2)) {
9529 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9530 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9531 __PYX_ERR(2, 409, __pyx_L1_error)
9533 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9534 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
9535 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
9536 __Pyx_INCREF(__pyx_t_4);
9537 __Pyx_INCREF(__pyx_t_5);
9539 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error)
9540 __Pyx_GOTREF(__pyx_t_4);
9541 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error)
9542 __Pyx_GOTREF(__pyx_t_5);
9544 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9546 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error)
9548 __pyx_v_have_slices = __pyx_t_4;
9550 __pyx_v_indices = __pyx_t_5;
9560 __Pyx_TraceLine(412,0,__PYX_ERR(2, 412, __pyx_L1_error))
9561 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error)
9571 __Pyx_TraceLine(413,0,__PYX_ERR(2, 413, __pyx_L1_error))
9572 __Pyx_XDECREF(__pyx_r);
9573 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error)
9574 __Pyx_GOTREF(__pyx_t_3);
9575 __pyx_r = __pyx_t_3;
9595 __Pyx_TraceLine(415,0,__PYX_ERR(2, 415, __pyx_L1_error))
9597 __pyx_t_6 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices);
if (unlikely(__pyx_t_6 == ((
char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error)
9598 __pyx_v_itemp = __pyx_t_6;
9607 __Pyx_TraceLine(416,0,__PYX_ERR(2, 416, __pyx_L1_error))
9608 __Pyx_XDECREF(__pyx_r);
9609 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error)
9610 __Pyx_GOTREF(__pyx_t_3);
9611 __pyx_r = __pyx_t_3;
9626 __Pyx_XDECREF(__pyx_t_3);
9627 __Pyx_XDECREF(__pyx_t_4);
9628 __Pyx_XDECREF(__pyx_t_5);
9629 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9632 __Pyx_XDECREF(__pyx_v_have_slices);
9633 __Pyx_XDECREF(__pyx_v_indices);
9634 __Pyx_XGIVEREF(__pyx_r);
9635 __Pyx_TraceReturn(__pyx_r, 0);
9636 __Pyx_RefNannyFinishContext();
9649 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
9650 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
9652 __Pyx_RefNannyDeclarations
9653 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
9654 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
9657 __Pyx_RefNannyFinishContext();
9661 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
9662 PyObject *__pyx_v_have_slices = NULL;
9663 PyObject *__pyx_v_obj = NULL;
9665 __Pyx_TraceDeclarations
9666 __Pyx_RefNannyDeclarations
9668 PyObject *__pyx_t_2 = NULL;
9669 PyObject *__pyx_t_3 = NULL;
9670 PyObject *__pyx_t_4 = NULL;
9671 int __pyx_lineno = 0;
9672 const char *__pyx_filename = NULL;
9673 int __pyx_clineno = 0;
9674 __Pyx_RefNannySetupContext(
"__setitem__", 0);
9675 __Pyx_TraceCall(
"__setitem__", __pyx_f[2], 418, 0, __PYX_ERR(2, 418, __pyx_L1_error));
9676 __Pyx_INCREF(__pyx_v_index);
9685 __Pyx_TraceLine(419,0,__PYX_ERR(2, 419, __pyx_L1_error))
9686 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
9687 if (unlikely(__pyx_t_1)) {
9696 __Pyx_TraceLine(420,0,__PYX_ERR(2, 420, __pyx_L1_error))
9697 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
9698 __Pyx_GOTREF(__pyx_t_2);
9699 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9700 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9701 __PYX_ERR(2, 420, __pyx_L1_error)
9719 __Pyx_TraceLine(422,0,__PYX_ERR(2, 422, __pyx_L1_error))
9720 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error)
9721 __Pyx_GOTREF(__pyx_t_2);
9722 if (likely(__pyx_t_2 != Py_None)) {
9723 PyObject* sequence = __pyx_t_2;
9724 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9725 if (unlikely(size != 2)) {
9726 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9727 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9728 __PYX_ERR(2, 422, __pyx_L1_error)
9730 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9731 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
9732 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
9733 __Pyx_INCREF(__pyx_t_3);
9734 __Pyx_INCREF(__pyx_t_4);
9736 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error)
9737 __Pyx_GOTREF(__pyx_t_3);
9738 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error)
9739 __Pyx_GOTREF(__pyx_t_4);
9741 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9743 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error)
9745 __pyx_v_have_slices = __pyx_t_3;
9747 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
9757 __Pyx_TraceLine(424,0,__PYX_ERR(2, 424, __pyx_L1_error))
9758 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
9768 __Pyx_TraceLine(425,0,__PYX_ERR(2, 425, __pyx_L1_error))
9769 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
9770 __Pyx_GOTREF(__pyx_t_2);
9771 __pyx_v_obj = __pyx_t_2;
9781 __Pyx_TraceLine(426,0,__PYX_ERR(2, 426, __pyx_L1_error))
9782 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error)
9792 __Pyx_TraceLine(427,0,__PYX_ERR(2, 427, __pyx_L1_error))
9793 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
9794 __Pyx_GOTREF(__pyx_t_2);
9795 __pyx_t_4 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
9796 __Pyx_GOTREF(__pyx_t_4);
9797 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9798 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9817 __Pyx_TraceLine(429,0,__PYX_ERR(2, 429, __pyx_L1_error))
9819 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error)
9820 __Pyx_GOTREF(__pyx_t_4);
9821 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error)
9822 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((
struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
9823 __Pyx_GOTREF(__pyx_t_2);
9824 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9825 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9846 __Pyx_TraceLine(431,0,__PYX_ERR(2, 431, __pyx_L1_error))
9848 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error)
9849 __Pyx_GOTREF(__pyx_t_2);
9850 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9866 __Pyx_XDECREF(__pyx_t_2);
9867 __Pyx_XDECREF(__pyx_t_3);
9868 __Pyx_XDECREF(__pyx_t_4);
9869 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9872 __Pyx_XDECREF(__pyx_v_have_slices);
9873 __Pyx_XDECREF(__pyx_v_obj);
9874 __Pyx_XDECREF(__pyx_v_index);
9875 __Pyx_TraceReturn(Py_None, 0);
9876 __Pyx_RefNannyFinishContext();
9888 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
9889 PyObject *__pyx_r = NULL;
9890 __Pyx_TraceDeclarations
9891 __Pyx_RefNannyDeclarations
9894 PyObject *__pyx_t_3 = NULL;
9895 PyObject *__pyx_t_4 = NULL;
9896 PyObject *__pyx_t_5 = NULL;
9897 PyObject *__pyx_t_6 = NULL;
9898 PyObject *__pyx_t_7 = NULL;
9899 PyObject *__pyx_t_8 = NULL;
9901 int __pyx_lineno = 0;
9902 const char *__pyx_filename = NULL;
9903 int __pyx_clineno = 0;
9904 __Pyx_RefNannySetupContext(
"is_slice", 0);
9905 __Pyx_TraceCall(
"is_slice", __pyx_f[2], 433, 0, __PYX_ERR(2, 433, __pyx_L1_error));
9906 __Pyx_INCREF(__pyx_v_obj);
9915 __Pyx_TraceLine(434,0,__PYX_ERR(2, 434, __pyx_L1_error))
9916 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
9917 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
9927 __Pyx_TraceLine(435,0,__PYX_ERR(2, 435, __pyx_L1_error))
9929 __Pyx_PyThreadState_declare
9930 __Pyx_PyThreadState_assign
9931 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
9932 __Pyx_XGOTREF(__pyx_t_3);
9933 __Pyx_XGOTREF(__pyx_t_4);
9934 __Pyx_XGOTREF(__pyx_t_5);
9944 __Pyx_TraceLine(436,0,__PYX_ERR(2, 436, __pyx_L4_error))
9945 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS));
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error)
9946 __Pyx_GOTREF(__pyx_t_6);
9955 __Pyx_TraceLine(437,0,__PYX_ERR(2, 437, __pyx_L4_error))
9956 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error)
9957 __Pyx_GOTREF(__pyx_t_7);
9966 __Pyx_TraceLine(436,0,__PYX_ERR(2, 436, __pyx_L4_error))
9967 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error)
9968 __Pyx_GOTREF(__pyx_t_8);
9969 __Pyx_INCREF(__pyx_v_obj);
9970 __Pyx_GIVEREF(__pyx_v_obj);
9971 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
9972 __Pyx_GIVEREF(__pyx_t_6);
9973 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
9974 __Pyx_GIVEREF(__pyx_t_7);
9975 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
9978 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error)
9979 __Pyx_GOTREF(__pyx_t_7);
9980 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9981 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
9992 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9993 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9994 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9995 goto __pyx_L9_try_end;
9997 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9998 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9999 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10008 __Pyx_TraceLine(438,0,__PYX_ERR(2, 438, __pyx_L6_except_error))
10009 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
10011 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10012 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error)
10013 __Pyx_GOTREF(__pyx_t_7);
10014 __Pyx_GOTREF(__pyx_t_8);
10015 __Pyx_GOTREF(__pyx_t_6);
10024 __Pyx_TraceLine(439,0,__PYX_ERR(2, 439, __pyx_L6_except_error))
10025 __Pyx_XDECREF(__pyx_r);
10026 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10027 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10028 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10029 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10030 goto __pyx_L7_except_return;
10032 goto __pyx_L6_except_error;
10033 __pyx_L6_except_error:;
10042 __Pyx_XGIVEREF(__pyx_t_3);
10043 __Pyx_XGIVEREF(__pyx_t_4);
10044 __Pyx_XGIVEREF(__pyx_t_5);
10045 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10046 goto __pyx_L1_error;
10047 __pyx_L7_except_return:;
10048 __Pyx_XGIVEREF(__pyx_t_3);
10049 __Pyx_XGIVEREF(__pyx_t_4);
10050 __Pyx_XGIVEREF(__pyx_t_5);
10051 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10072 __Pyx_TraceLine(441,0,__PYX_ERR(2, 441, __pyx_L1_error))
10073 __Pyx_XDECREF(__pyx_r);
10074 __Pyx_INCREF(__pyx_v_obj);
10075 __pyx_r = __pyx_v_obj;
10088 __Pyx_XDECREF(__pyx_t_6);
10089 __Pyx_XDECREF(__pyx_t_7);
10090 __Pyx_XDECREF(__pyx_t_8);
10091 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10094 __Pyx_XDECREF(__pyx_v_obj);
10095 __Pyx_XGIVEREF(__pyx_r);
10096 __Pyx_TraceReturn(__pyx_r, 0);
10097 __Pyx_RefNannyFinishContext();
10109 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
10110 __Pyx_memviewslice __pyx_v_dst_slice;
10111 __Pyx_memviewslice __pyx_v_src_slice;
10112 PyObject *__pyx_r = NULL;
10113 __Pyx_TraceDeclarations
10114 __Pyx_RefNannyDeclarations
10115 __Pyx_memviewslice *__pyx_t_1;
10116 __Pyx_memviewslice *__pyx_t_2;
10117 PyObject *__pyx_t_3 = NULL;
10121 int __pyx_lineno = 0;
10122 const char *__pyx_filename = NULL;
10123 int __pyx_clineno = 0;
10124 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
10125 __Pyx_TraceCall(
"setitem_slice_assignment", __pyx_f[2], 443, 0, __PYX_ERR(2, 443, __pyx_L1_error));
10134 __Pyx_TraceLine(447,0,__PYX_ERR(2, 447, __pyx_L1_error))
10135 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error)
10136 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error)
10145 __Pyx_TraceLine(448,0,__PYX_ERR(2, 448, __pyx_L1_error))
10146 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error)
10147 __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice));
if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error)
10156 __Pyx_TraceLine(449,0,__PYX_ERR(2, 449, __pyx_L1_error))
10157 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error)
10158 __Pyx_GOTREF(__pyx_t_3);
10159 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error)
10160 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10161 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error)
10162 __Pyx_GOTREF(__pyx_t_3);
10163 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error)
10164 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10173 __Pyx_TraceLine(447,0,__PYX_ERR(2, 447, __pyx_L1_error))
10174 __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(2, 447, __pyx_L1_error)
10185 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10188 __Pyx_XDECREF(__pyx_t_3);
10189 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
10192 __Pyx_XGIVEREF(__pyx_r);
10193 __Pyx_TraceReturn(__pyx_r, 0);
10194 __Pyx_RefNannyFinishContext();
10206 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
10207 int __pyx_v_array[0x80];
10209 void *__pyx_v_item;
10210 __Pyx_memviewslice *__pyx_v_dst_slice;
10211 __Pyx_memviewslice __pyx_v_tmp_slice;
10212 PyObject *__pyx_r = NULL;
10213 __Pyx_TraceDeclarations
10214 __Pyx_RefNannyDeclarations
10215 __Pyx_memviewslice *__pyx_t_1;
10217 PyObject *__pyx_t_3 = NULL;
10220 char const *__pyx_t_6;
10221 PyObject *__pyx_t_7 = NULL;
10222 PyObject *__pyx_t_8 = NULL;
10223 PyObject *__pyx_t_9 = NULL;
10224 PyObject *__pyx_t_10 = NULL;
10225 PyObject *__pyx_t_11 = NULL;
10226 PyObject *__pyx_t_12 = NULL;
10227 int __pyx_lineno = 0;
10228 const char *__pyx_filename = NULL;
10229 int __pyx_clineno = 0;
10230 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
10231 __Pyx_TraceCall(
"setitem_slice_assign_scalar", __pyx_f[2], 451, 0, __PYX_ERR(2, 451, __pyx_L1_error));
10240 __Pyx_TraceLine(453,0,__PYX_ERR(2, 453, __pyx_L1_error))
10241 __pyx_v_tmp = NULL;
10250 __Pyx_TraceLine(458,0,__PYX_ERR(2, 458, __pyx_L1_error))
10251 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error)
10252 __pyx_v_dst_slice = __pyx_t_1;
10261 __Pyx_TraceLine(460,0,__PYX_ERR(2, 460, __pyx_L1_error))
10262 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
10272 __Pyx_TraceLine(461,0,__PYX_ERR(2, 461, __pyx_L1_error))
10273 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
10282 __Pyx_TraceLine(462,0,__PYX_ERR(2, 462, __pyx_L1_error))
10283 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
10284 if (unlikely(__pyx_t_2)) {
10293 __Pyx_TraceLine(463,0,__PYX_ERR(2, 463, __pyx_L1_error))
10294 PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error)
10312 __Pyx_TraceLine(464,0,__PYX_ERR(2, 464, __pyx_L1_error))
10313 __pyx_v_item = __pyx_v_tmp;
10332 __Pyx_TraceLine(466,0,__PYX_ERR(2, 466, __pyx_L1_error))
10334 __pyx_v_item = ((
void *)__pyx_v_array);
10345 __Pyx_TraceLine(468,0,__PYX_ERR(2, 468, __pyx_L1_error))
10355 __Pyx_TraceLine(469,0,__PYX_ERR(2, 469, __pyx_L6_error))
10356 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
10366 __Pyx_TraceLine(470,0,__PYX_ERR(2, 470, __pyx_L6_error))
10367 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
10386 __Pyx_TraceLine(472,0,__PYX_ERR(2, 472, __pyx_L6_error))
10388 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((
char *)__pyx_v_item), __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error)
10389 __Pyx_GOTREF(__pyx_t_3);
10390 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10401 __Pyx_TraceLine(476,0,__PYX_ERR(2, 476, __pyx_L6_error))
10402 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
10412 __Pyx_TraceLine(477,0,__PYX_ERR(2, 477, __pyx_L6_error))
10413 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error)
10414 __Pyx_GOTREF(__pyx_t_3);
10415 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10433 __Pyx_TraceLine(478,0,__PYX_ERR(2, 478, __pyx_L6_error))
10434 __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
10444 __Pyx_TraceLine(481,0,__PYX_ERR(2, 481, __pyx_L6_error))
10447 PyMem_Free(__pyx_v_tmp);
10452 __Pyx_PyThreadState_declare
10453 __Pyx_PyThreadState_assign
10454 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
10455 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10456 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
10457 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
10458 __Pyx_XGOTREF(__pyx_t_7);
10459 __Pyx_XGOTREF(__pyx_t_8);
10460 __Pyx_XGOTREF(__pyx_t_9);
10461 __Pyx_XGOTREF(__pyx_t_10);
10462 __Pyx_XGOTREF(__pyx_t_11);
10463 __Pyx_XGOTREF(__pyx_t_12);
10464 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
10466 PyMem_Free(__pyx_v_tmp);
10468 if (PY_MAJOR_VERSION >= 3) {
10469 __Pyx_XGIVEREF(__pyx_t_10);
10470 __Pyx_XGIVEREF(__pyx_t_11);
10471 __Pyx_XGIVEREF(__pyx_t_12);
10472 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
10474 __Pyx_XGIVEREF(__pyx_t_7);
10475 __Pyx_XGIVEREF(__pyx_t_8);
10476 __Pyx_XGIVEREF(__pyx_t_9);
10477 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
10478 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
10479 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
10480 goto __pyx_L1_error;
10494 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10497 __Pyx_XDECREF(__pyx_t_3);
10498 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
10501 __Pyx_XGIVEREF(__pyx_r);
10502 __Pyx_TraceReturn(__pyx_r, 0);
10503 __Pyx_RefNannyFinishContext();
10515 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10516 char *__pyx_v_itemp;
10517 PyObject *__pyx_r = NULL;
10518 __Pyx_TraceDeclarations
10519 __Pyx_RefNannyDeclarations
10521 PyObject *__pyx_t_2 = NULL;
10522 int __pyx_lineno = 0;
10523 const char *__pyx_filename = NULL;
10524 int __pyx_clineno = 0;
10525 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
10526 __Pyx_TraceCall(
"setitem_indexed", __pyx_f[2], 483, 0, __PYX_ERR(2, 483, __pyx_L1_error));
10535 __Pyx_TraceLine(484,0,__PYX_ERR(2, 484, __pyx_L1_error))
10536 __pyx_t_1 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index);
if (unlikely(__pyx_t_1 == ((
char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error)
10537 __pyx_v_itemp = __pyx_t_1;
10546 __Pyx_TraceLine(485,0,__PYX_ERR(2, 485, __pyx_L1_error))
10547 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error)
10548 __Pyx_GOTREF(__pyx_t_2);
10549 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10560 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10563 __Pyx_XDECREF(__pyx_t_2);
10564 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
10567 __Pyx_XGIVEREF(__pyx_r);
10568 __Pyx_TraceReturn(__pyx_r, 0);
10569 __Pyx_RefNannyFinishContext();
10581 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
10582 PyObject *__pyx_v_struct = NULL;
10583 PyObject *__pyx_v_bytesitem = 0;
10584 PyObject *__pyx_v_result = NULL;
10585 PyObject *__pyx_r = NULL;
10586 __Pyx_TraceDeclarations
10587 __Pyx_RefNannyDeclarations
10588 PyObject *__pyx_t_1 = NULL;
10589 PyObject *__pyx_t_2 = NULL;
10590 PyObject *__pyx_t_3 = NULL;
10591 PyObject *__pyx_t_4 = NULL;
10592 PyObject *__pyx_t_5 = NULL;
10593 PyObject *__pyx_t_6 = NULL;
10594 PyObject *__pyx_t_7 = NULL;
10596 PyObject *__pyx_t_9 = NULL;
10599 int __pyx_lineno = 0;
10600 const char *__pyx_filename = NULL;
10601 int __pyx_clineno = 0;
10602 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
10603 __Pyx_TraceCall(
"convert_item_to_object", __pyx_f[2], 487, 0, __PYX_ERR(2, 487, __pyx_L1_error));
10612 __Pyx_TraceLine(490,0,__PYX_ERR(2, 490, __pyx_L1_error))
10613 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error)
10614 __Pyx_GOTREF(__pyx_t_1);
10615 __pyx_v_struct = __pyx_t_1;
10625 __Pyx_TraceLine(493,0,__PYX_ERR(2, 493, __pyx_L1_error))
10626 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error)
10627 __Pyx_GOTREF(__pyx_t_1);
10628 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
10638 __Pyx_TraceLine(494,0,__PYX_ERR(2, 494, __pyx_L1_error))
10640 __Pyx_PyThreadState_declare
10641 __Pyx_PyThreadState_assign
10642 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
10643 __Pyx_XGOTREF(__pyx_t_2);
10644 __Pyx_XGOTREF(__pyx_t_3);
10645 __Pyx_XGOTREF(__pyx_t_4);
10655 __Pyx_TraceLine(495,0,__PYX_ERR(2, 495, __pyx_L3_error))
10656 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error)
10657 __Pyx_GOTREF(__pyx_t_5);
10658 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error)
10659 __Pyx_GOTREF(__pyx_t_6);
10662 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
10663 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
10664 if (likely(__pyx_t_7)) {
10665 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
10666 __Pyx_INCREF(__pyx_t_7);
10667 __Pyx_INCREF(
function);
10668 __Pyx_DECREF_SET(__pyx_t_5,
function);
10672 #if CYTHON_FAST_PYCALL
10673 if (PyFunction_Check(__pyx_t_5)) {
10674 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
10675 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
10676 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10677 __Pyx_GOTREF(__pyx_t_1);
10678 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10681 #if CYTHON_FAST_PYCCALL
10682 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
10683 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
10684 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
10685 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10686 __Pyx_GOTREF(__pyx_t_1);
10687 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10691 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error)
10692 __Pyx_GOTREF(__pyx_t_9);
10694 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
10696 __Pyx_GIVEREF(__pyx_t_6);
10697 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
10698 __Pyx_INCREF(__pyx_v_bytesitem);
10699 __Pyx_GIVEREF(__pyx_v_bytesitem);
10700 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
10702 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
10703 __Pyx_GOTREF(__pyx_t_1);
10704 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10706 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10707 __pyx_v_result = __pyx_t_1;
10726 __Pyx_TraceLine(499,0,__PYX_ERR(2, 499, __pyx_L5_except_error))
10728 __pyx_t_10 = strlen(__pyx_v_self->view.format);
10729 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
10739 __Pyx_TraceLine(500,0,__PYX_ERR(2, 500, __pyx_L5_except_error))
10740 __Pyx_XDECREF(__pyx_r);
10741 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error)
10742 __Pyx_GOTREF(__pyx_t_1);
10743 __pyx_r = __pyx_t_1;
10745 goto __pyx_L6_except_return;
10763 __Pyx_TraceLine(501,0,__PYX_ERR(2, 501, __pyx_L5_except_error))
10764 __Pyx_XDECREF(__pyx_r);
10765 __Pyx_INCREF(__pyx_v_result);
10766 __pyx_r = __pyx_v_result;
10767 goto __pyx_L6_except_return;
10770 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10771 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10772 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10773 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10774 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
10783 __Pyx_TraceLine(496,0,__PYX_ERR(2, 496, __pyx_L5_except_error))
10784 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
10785 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error)
10786 __Pyx_GOTREF(__pyx_t_6);
10787 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
10788 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10789 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
10790 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
10792 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10793 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error)
10794 __Pyx_GOTREF(__pyx_t_9);
10795 __Pyx_GOTREF(__pyx_t_5);
10796 __Pyx_GOTREF(__pyx_t_1);
10805 __Pyx_TraceLine(497,0,__PYX_ERR(2, 497, __pyx_L5_except_error))
10806 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error)
10807 __Pyx_GOTREF(__pyx_t_6);
10808 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
10809 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10810 __PYX_ERR(2, 497, __pyx_L5_except_error)
10812 goto __pyx_L5_except_error;
10813 __pyx_L5_except_error:;
10822 __Pyx_XGIVEREF(__pyx_t_2);
10823 __Pyx_XGIVEREF(__pyx_t_3);
10824 __Pyx_XGIVEREF(__pyx_t_4);
10825 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
10826 goto __pyx_L1_error;
10827 __pyx_L6_except_return:;
10828 __Pyx_XGIVEREF(__pyx_t_2);
10829 __Pyx_XGIVEREF(__pyx_t_3);
10830 __Pyx_XGIVEREF(__pyx_t_4);
10831 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
10845 __Pyx_XDECREF(__pyx_t_1);
10846 __Pyx_XDECREF(__pyx_t_5);
10847 __Pyx_XDECREF(__pyx_t_6);
10848 __Pyx_XDECREF(__pyx_t_7);
10849 __Pyx_XDECREF(__pyx_t_9);
10850 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10853 __Pyx_XDECREF(__pyx_v_struct);
10854 __Pyx_XDECREF(__pyx_v_bytesitem);
10855 __Pyx_XDECREF(__pyx_v_result);
10856 __Pyx_XGIVEREF(__pyx_r);
10857 __Pyx_TraceReturn(__pyx_r, 0);
10858 __Pyx_RefNannyFinishContext();
10870 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
10871 PyObject *__pyx_v_struct = NULL;
10873 PyObject *__pyx_v_bytesvalue = 0;
10874 Py_ssize_t __pyx_v_i;
10875 PyObject *__pyx_r = NULL;
10876 __Pyx_TraceDeclarations
10877 __Pyx_RefNannyDeclarations
10878 PyObject *__pyx_t_1 = NULL;
10881 PyObject *__pyx_t_4 = NULL;
10882 PyObject *__pyx_t_5 = NULL;
10883 PyObject *__pyx_t_6 = NULL;
10885 PyObject *__pyx_t_8 = NULL;
10886 Py_ssize_t __pyx_t_9;
10887 PyObject *__pyx_t_10 = NULL;
10892 int __pyx_lineno = 0;
10893 const char *__pyx_filename = NULL;
10894 int __pyx_clineno = 0;
10895 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
10896 __Pyx_TraceCall(
"assign_item_from_object", __pyx_f[2], 503, 0, __PYX_ERR(2, 503, __pyx_L1_error));
10905 __Pyx_TraceLine(506,0,__PYX_ERR(2, 506, __pyx_L1_error))
10906 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error)
10907 __Pyx_GOTREF(__pyx_t_1);
10908 __pyx_v_struct = __pyx_t_1;
10918 __Pyx_TraceLine(511,0,__PYX_ERR(2, 511, __pyx_L1_error))
10919 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
10920 __pyx_t_3 = (__pyx_t_2 != 0);
10930 __Pyx_TraceLine(512,0,__PYX_ERR(2, 512, __pyx_L1_error))
10931 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
10932 __Pyx_GOTREF(__pyx_t_1);
10933 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10934 __Pyx_GOTREF(__pyx_t_4);
10935 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error)
10936 __Pyx_GOTREF(__pyx_t_5);
10937 __Pyx_GIVEREF(__pyx_t_4);
10938 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10940 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10941 __Pyx_GOTREF(__pyx_t_4);
10942 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
10943 __Pyx_GOTREF(__pyx_t_6);
10944 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10945 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10946 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10947 __Pyx_GOTREF(__pyx_t_4);
10948 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10949 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10950 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
10951 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
10971 __Pyx_TraceLine(514,0,__PYX_ERR(2, 514, __pyx_L1_error))
10973 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error)
10974 __Pyx_GOTREF(__pyx_t_6);
10975 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error)
10976 __Pyx_GOTREF(__pyx_t_1);
10979 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
10980 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
10981 if (likely(__pyx_t_5)) {
10982 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
10983 __Pyx_INCREF(__pyx_t_5);
10984 __Pyx_INCREF(
function);
10985 __Pyx_DECREF_SET(__pyx_t_6,
function);
10989 #if CYTHON_FAST_PYCALL
10990 if (PyFunction_Check(__pyx_t_6)) {
10991 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
10992 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
10993 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10994 __Pyx_GOTREF(__pyx_t_4);
10995 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10998 #if CYTHON_FAST_PYCCALL
10999 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
11000 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11001 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
11002 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11003 __Pyx_GOTREF(__pyx_t_4);
11004 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11008 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error)
11009 __Pyx_GOTREF(__pyx_t_8);
11011 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
11013 __Pyx_GIVEREF(__pyx_t_1);
11014 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
11015 __Pyx_INCREF(__pyx_v_value);
11016 __Pyx_GIVEREF(__pyx_v_value);
11017 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
11019 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
11020 __Pyx_GOTREF(__pyx_t_4);
11021 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11023 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11024 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error)
11025 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11037 __Pyx_TraceLine(516,0,__PYX_ERR(2, 516, __pyx_L1_error))
11039 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
11040 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
11041 __PYX_ERR(2, 516, __pyx_L1_error)
11043 __Pyx_INCREF(__pyx_v_bytesvalue);
11044 __pyx_t_10 = __pyx_v_bytesvalue;
11045 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
11046 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
11047 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
11048 __pyx_t_11 = __pyx_t_14;
11049 __pyx_v_c = (__pyx_t_11[0]);
11058 __Pyx_TraceLine(517,0,__PYX_ERR(2, 517, __pyx_L1_error))
11059 __pyx_v_i = __pyx_t_9;
11068 __Pyx_TraceLine(516,0,__PYX_ERR(2, 516, __pyx_L1_error))
11069 __pyx_t_9 = (__pyx_t_9 + 1);
11078 __Pyx_TraceLine(517,0,__PYX_ERR(2, 517, __pyx_L1_error))
11079 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
11081 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11092 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11095 __Pyx_XDECREF(__pyx_t_1);
11096 __Pyx_XDECREF(__pyx_t_4);
11097 __Pyx_XDECREF(__pyx_t_5);
11098 __Pyx_XDECREF(__pyx_t_6);
11099 __Pyx_XDECREF(__pyx_t_8);
11100 __Pyx_XDECREF(__pyx_t_10);
11101 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11104 __Pyx_XDECREF(__pyx_v_struct);
11105 __Pyx_XDECREF(__pyx_v_bytesvalue);
11106 __Pyx_XGIVEREF(__pyx_r);
11107 __Pyx_TraceReturn(__pyx_r, 0);
11108 __Pyx_RefNannyFinishContext();
11121 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
11122 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
11124 __Pyx_RefNannyDeclarations
11125 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
11126 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
11129 __Pyx_RefNannyFinishContext();
11133 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
11135 __Pyx_TraceDeclarations
11136 __Pyx_RefNannyDeclarations
11139 PyObject *__pyx_t_3 = NULL;
11140 Py_ssize_t *__pyx_t_4;
11144 Py_ssize_t __pyx_t_8;
11145 int __pyx_lineno = 0;
11146 const char *__pyx_filename = NULL;
11147 int __pyx_clineno = 0;
11148 if (__pyx_v_info == NULL) {
11149 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
11152 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
11153 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
11154 __Pyx_GIVEREF(__pyx_v_info->obj);
11155 __Pyx_TraceCall(
"__getbuffer__", __pyx_f[2], 520, 0, __PYX_ERR(2, 520, __pyx_L1_error));
11164 __Pyx_TraceLine(521,0,__PYX_ERR(2, 521, __pyx_L1_error))
11165 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
11168 __pyx_t_1 = __pyx_t_2;
11169 goto __pyx_L4_bool_binop_done;
11171 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
11172 __pyx_t_1 = __pyx_t_2;
11173 __pyx_L4_bool_binop_done:;
11174 if (unlikely(__pyx_t_1)) {
11183 __Pyx_TraceLine(522,0,__PYX_ERR(2, 522, __pyx_L1_error))
11184 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error)
11185 __Pyx_GOTREF(__pyx_t_3);
11186 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
11187 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11188 __PYX_ERR(2, 522, __pyx_L1_error)
11206 __Pyx_TraceLine(524,0,__PYX_ERR(2, 524, __pyx_L1_error))
11207 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
11217 __Pyx_TraceLine(525,0,__PYX_ERR(2, 525, __pyx_L1_error))
11218 __pyx_t_4 = __pyx_v_self->view.shape;
11219 __pyx_v_info->shape = __pyx_t_4;
11238 __Pyx_TraceLine(527,0,__PYX_ERR(2, 527, __pyx_L1_error))
11240 __pyx_v_info->shape = NULL;
11251 __Pyx_TraceLine(529,0,__PYX_ERR(2, 529, __pyx_L1_error))
11252 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
11262 __Pyx_TraceLine(530,0,__PYX_ERR(2, 530, __pyx_L1_error))
11263 __pyx_t_4 = __pyx_v_self->view.strides;
11264 __pyx_v_info->strides = __pyx_t_4;
11283 __Pyx_TraceLine(532,0,__PYX_ERR(2, 532, __pyx_L1_error))
11285 __pyx_v_info->strides = NULL;
11296 __Pyx_TraceLine(534,0,__PYX_ERR(2, 534, __pyx_L1_error))
11297 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
11307 __Pyx_TraceLine(535,0,__PYX_ERR(2, 535, __pyx_L1_error))
11308 __pyx_t_4 = __pyx_v_self->view.suboffsets;
11309 __pyx_v_info->suboffsets = __pyx_t_4;
11328 __Pyx_TraceLine(537,0,__PYX_ERR(2, 537, __pyx_L1_error))
11330 __pyx_v_info->suboffsets = NULL;
11341 __Pyx_TraceLine(539,0,__PYX_ERR(2, 539, __pyx_L1_error))
11342 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
11352 __Pyx_TraceLine(540,0,__PYX_ERR(2, 540, __pyx_L1_error))
11353 __pyx_t_5 = __pyx_v_self->view.format;
11354 __pyx_v_info->format = __pyx_t_5;
11373 __Pyx_TraceLine(542,0,__PYX_ERR(2, 542, __pyx_L1_error))
11375 __pyx_v_info->format = NULL;
11386 __Pyx_TraceLine(544,0,__PYX_ERR(2, 544, __pyx_L1_error))
11387 __pyx_t_6 = __pyx_v_self->view.buf;
11388 __pyx_v_info->buf = __pyx_t_6;
11397 __Pyx_TraceLine(545,0,__PYX_ERR(2, 545, __pyx_L1_error))
11398 __pyx_t_7 = __pyx_v_self->view.ndim;
11399 __pyx_v_info->ndim = __pyx_t_7;
11408 __Pyx_TraceLine(546,0,__PYX_ERR(2, 546, __pyx_L1_error))
11409 __pyx_t_8 = __pyx_v_self->view.itemsize;
11410 __pyx_v_info->itemsize = __pyx_t_8;
11419 __Pyx_TraceLine(547,0,__PYX_ERR(2, 547, __pyx_L1_error))
11420 __pyx_t_8 = __pyx_v_self->view.len;
11421 __pyx_v_info->len = __pyx_t_8;
11430 __Pyx_TraceLine(548,0,__PYX_ERR(2, 548, __pyx_L1_error))
11431 __pyx_t_1 = __pyx_v_self->view.readonly;
11432 __pyx_v_info->readonly = __pyx_t_1;
11441 __Pyx_TraceLine(549,0,__PYX_ERR(2, 549, __pyx_L1_error))
11442 __Pyx_INCREF(((PyObject *)__pyx_v_self));
11443 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11444 __Pyx_GOTREF(__pyx_v_info->obj);
11445 __Pyx_DECREF(__pyx_v_info->obj);
11446 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
11460 __Pyx_XDECREF(__pyx_t_3);
11461 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11463 if (__pyx_v_info->obj != NULL) {
11464 __Pyx_GOTREF(__pyx_v_info->obj);
11465 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11469 if (__pyx_v_info->obj == Py_None) {
11470 __Pyx_GOTREF(__pyx_v_info->obj);
11471 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11474 __Pyx_TraceReturn(Py_None, 0);
11475 __Pyx_RefNannyFinishContext();
11488 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
11489 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
11490 PyObject *__pyx_r = 0;
11491 __Pyx_RefNannyDeclarations
11492 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11493 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11496 __Pyx_RefNannyFinishContext();
11500 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11501 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
11502 PyObject *__pyx_r = NULL;
11503 __Pyx_TraceDeclarations
11504 __Pyx_RefNannyDeclarations
11505 PyObject *__pyx_t_1 = NULL;
11507 int __pyx_lineno = 0;
11508 const char *__pyx_filename = NULL;
11509 int __pyx_clineno = 0;
11510 __Pyx_RefNannySetupContext(
"__get__", 0);
11511 __Pyx_TraceCall(
"__get__", __pyx_f[2], 555, 0, __PYX_ERR(2, 555, __pyx_L1_error));
11520 __Pyx_TraceLine(556,0,__PYX_ERR(2, 556, __pyx_L1_error))
11521 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error)
11522 __Pyx_GOTREF(__pyx_t_1);
11523 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error)
11524 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
11534 __Pyx_TraceLine(557,0,__PYX_ERR(2, 557, __pyx_L1_error))
11535 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice));
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(2, 557, __pyx_L1_error)
11544 __Pyx_TraceLine(558,0,__PYX_ERR(2, 558, __pyx_L1_error))
11545 __Pyx_XDECREF(__pyx_r);
11546 __Pyx_INCREF(((PyObject *)__pyx_v_result));
11547 __pyx_r = ((PyObject *)__pyx_v_result);
11560 __Pyx_XDECREF(__pyx_t_1);
11561 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11564 __Pyx_XDECREF((PyObject *)__pyx_v_result);
11565 __Pyx_XGIVEREF(__pyx_r);
11566 __Pyx_TraceReturn(__pyx_r, 0);
11567 __Pyx_RefNannyFinishContext();
11580 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
11581 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
11582 PyObject *__pyx_r = 0;
11583 __Pyx_RefNannyDeclarations
11584 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11585 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11588 __Pyx_RefNannyFinishContext();
11592 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11593 PyObject *__pyx_r = NULL;
11594 __Pyx_TraceDeclarations
11595 __Pyx_RefNannyDeclarations
11596 int __pyx_lineno = 0;
11597 const char *__pyx_filename = NULL;
11598 int __pyx_clineno = 0;
11599 __Pyx_RefNannySetupContext(
"__get__", 0);
11600 __Pyx_TraceCall(
"__get__", __pyx_f[2], 561, 0, __PYX_ERR(2, 561, __pyx_L1_error));
11609 __Pyx_TraceLine(562,0,__PYX_ERR(2, 562, __pyx_L1_error))
11610 __Pyx_XDECREF(__pyx_r);
11611 __Pyx_INCREF(__pyx_v_self->obj);
11612 __pyx_r = __pyx_v_self->obj;
11625 __Pyx_AddTraceback(
"View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11628 __Pyx_XGIVEREF(__pyx_r);
11629 __Pyx_TraceReturn(__pyx_r, 0);
11630 __Pyx_RefNannyFinishContext();
11643 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
11644 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
11645 PyObject *__pyx_r = 0;
11646 __Pyx_RefNannyDeclarations
11647 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11648 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11651 __Pyx_RefNannyFinishContext();
11655 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11656 Py_ssize_t __pyx_v_length;
11657 PyObject *__pyx_r = NULL;
11658 __Pyx_TraceDeclarations
11659 __Pyx_RefNannyDeclarations
11660 PyObject *__pyx_t_1 = NULL;
11661 Py_ssize_t *__pyx_t_2;
11662 Py_ssize_t *__pyx_t_3;
11663 Py_ssize_t *__pyx_t_4;
11664 PyObject *__pyx_t_5 = NULL;
11665 int __pyx_lineno = 0;
11666 const char *__pyx_filename = NULL;
11667 int __pyx_clineno = 0;
11668 __Pyx_RefNannySetupContext(
"__get__", 0);
11669 __Pyx_TraceCall(
"__get__", __pyx_f[2], 565, 0, __PYX_ERR(2, 565, __pyx_L1_error));
11678 __Pyx_TraceLine(566,0,__PYX_ERR(2, 566, __pyx_L1_error))
11679 __Pyx_XDECREF(__pyx_r);
11680 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error)
11681 __Pyx_GOTREF(__pyx_t_1);
11682 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
11683 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
11684 __pyx_t_2 = __pyx_t_4;
11685 __pyx_v_length = (__pyx_t_2[0]);
11686 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error)
11687 __Pyx_GOTREF(__pyx_t_5);
11688 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error)
11689 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11691 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error)
11692 __Pyx_GOTREF(__pyx_t_5);
11693 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11694 __pyx_r = __pyx_t_5;
11708 __Pyx_XDECREF(__pyx_t_1);
11709 __Pyx_XDECREF(__pyx_t_5);
11710 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11713 __Pyx_XGIVEREF(__pyx_r);
11714 __Pyx_TraceReturn(__pyx_r, 0);
11715 __Pyx_RefNannyFinishContext();
11728 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
11729 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
11730 PyObject *__pyx_r = 0;
11731 __Pyx_RefNannyDeclarations
11732 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11733 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11736 __Pyx_RefNannyFinishContext();
11740 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11741 Py_ssize_t __pyx_v_stride;
11742 PyObject *__pyx_r = NULL;
11743 __Pyx_TraceDeclarations
11744 __Pyx_RefNannyDeclarations
11746 PyObject *__pyx_t_2 = NULL;
11747 Py_ssize_t *__pyx_t_3;
11748 Py_ssize_t *__pyx_t_4;
11749 Py_ssize_t *__pyx_t_5;
11750 PyObject *__pyx_t_6 = NULL;
11751 int __pyx_lineno = 0;
11752 const char *__pyx_filename = NULL;
11753 int __pyx_clineno = 0;
11754 __Pyx_RefNannySetupContext(
"__get__", 0);
11755 __Pyx_TraceCall(
"__get__", __pyx_f[2], 569, 0, __PYX_ERR(2, 569, __pyx_L1_error));
11764 __Pyx_TraceLine(570,0,__PYX_ERR(2, 570, __pyx_L1_error))
11765 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
11766 if (unlikely(__pyx_t_1)) {
11775 __Pyx_TraceLine(572,0,__PYX_ERR(2, 572, __pyx_L1_error))
11776 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
11777 __Pyx_GOTREF(__pyx_t_2);
11778 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11779 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11780 __PYX_ERR(2, 572, __pyx_L1_error)
11798 __Pyx_TraceLine(574,0,__PYX_ERR(2, 574, __pyx_L1_error))
11799 __Pyx_XDECREF(__pyx_r);
11800 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error)
11801 __Pyx_GOTREF(__pyx_t_2);
11802 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
11803 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
11804 __pyx_t_3 = __pyx_t_5;
11805 __pyx_v_stride = (__pyx_t_3[0]);
11806 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error)
11807 __Pyx_GOTREF(__pyx_t_6);
11808 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error)
11809 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11811 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error)
11812 __Pyx_GOTREF(__pyx_t_6);
11813 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11814 __pyx_r = __pyx_t_6;
11828 __Pyx_XDECREF(__pyx_t_2);
11829 __Pyx_XDECREF(__pyx_t_6);
11830 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11833 __Pyx_XGIVEREF(__pyx_r);
11834 __Pyx_TraceReturn(__pyx_r, 0);
11835 __Pyx_RefNannyFinishContext();
11848 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
11849 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
11850 PyObject *__pyx_r = 0;
11851 __Pyx_RefNannyDeclarations
11852 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11853 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11856 __Pyx_RefNannyFinishContext();
11860 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11861 Py_ssize_t __pyx_v_suboffset;
11862 PyObject *__pyx_r = NULL;
11863 __Pyx_TraceDeclarations
11864 __Pyx_RefNannyDeclarations
11866 PyObject *__pyx_t_2 = NULL;
11867 PyObject *__pyx_t_3 = NULL;
11868 Py_ssize_t *__pyx_t_4;
11869 Py_ssize_t *__pyx_t_5;
11870 Py_ssize_t *__pyx_t_6;
11871 int __pyx_lineno = 0;
11872 const char *__pyx_filename = NULL;
11873 int __pyx_clineno = 0;
11874 __Pyx_RefNannySetupContext(
"__get__", 0);
11875 __Pyx_TraceCall(
"__get__", __pyx_f[2], 577, 0, __PYX_ERR(2, 577, __pyx_L1_error));
11884 __Pyx_TraceLine(578,0,__PYX_ERR(2, 578, __pyx_L1_error))
11885 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
11895 __Pyx_TraceLine(579,0,__PYX_ERR(2, 579, __pyx_L1_error))
11896 __Pyx_XDECREF(__pyx_r);
11897 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
11898 __Pyx_GOTREF(__pyx_t_2);
11899 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__14, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
11900 __Pyx_GOTREF(__pyx_t_3);
11901 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11902 __pyx_r = __pyx_t_3;
11922 __Pyx_TraceLine(581,0,__PYX_ERR(2, 581, __pyx_L1_error))
11923 __Pyx_XDECREF(__pyx_r);
11924 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error)
11925 __Pyx_GOTREF(__pyx_t_3);
11926 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
11927 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
11928 __pyx_t_4 = __pyx_t_6;
11929 __pyx_v_suboffset = (__pyx_t_4[0]);
11930 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error)
11931 __Pyx_GOTREF(__pyx_t_2);
11932 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error)
11933 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11935 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error)
11936 __Pyx_GOTREF(__pyx_t_2);
11937 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11938 __pyx_r = __pyx_t_2;
11952 __Pyx_XDECREF(__pyx_t_2);
11953 __Pyx_XDECREF(__pyx_t_3);
11954 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11957 __Pyx_XGIVEREF(__pyx_r);
11958 __Pyx_TraceReturn(__pyx_r, 0);
11959 __Pyx_RefNannyFinishContext();
11972 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
11973 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
11974 PyObject *__pyx_r = 0;
11975 __Pyx_RefNannyDeclarations
11976 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11977 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11980 __Pyx_RefNannyFinishContext();
11984 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11985 PyObject *__pyx_r = NULL;
11986 __Pyx_TraceDeclarations
11987 __Pyx_RefNannyDeclarations
11988 PyObject *__pyx_t_1 = NULL;
11989 int __pyx_lineno = 0;
11990 const char *__pyx_filename = NULL;
11991 int __pyx_clineno = 0;
11992 __Pyx_RefNannySetupContext(
"__get__", 0);
11993 __Pyx_TraceCall(
"__get__", __pyx_f[2], 584, 0, __PYX_ERR(2, 584, __pyx_L1_error));
12002 __Pyx_TraceLine(585,0,__PYX_ERR(2, 585, __pyx_L1_error))
12003 __Pyx_XDECREF(__pyx_r);
12004 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error)
12005 __Pyx_GOTREF(__pyx_t_1);
12006 __pyx_r = __pyx_t_1;
12020 __Pyx_XDECREF(__pyx_t_1);
12021 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12024 __Pyx_XGIVEREF(__pyx_r);
12025 __Pyx_TraceReturn(__pyx_r, 0);
12026 __Pyx_RefNannyFinishContext();
12039 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
12040 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
12041 PyObject *__pyx_r = 0;
12042 __Pyx_RefNannyDeclarations
12043 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12044 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12047 __Pyx_RefNannyFinishContext();
12051 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12052 PyObject *__pyx_r = NULL;
12053 __Pyx_TraceDeclarations
12054 __Pyx_RefNannyDeclarations
12055 PyObject *__pyx_t_1 = NULL;
12056 int __pyx_lineno = 0;
12057 const char *__pyx_filename = NULL;
12058 int __pyx_clineno = 0;
12059 __Pyx_RefNannySetupContext(
"__get__", 0);
12060 __Pyx_TraceCall(
"__get__", __pyx_f[2], 588, 0, __PYX_ERR(2, 588, __pyx_L1_error));
12069 __Pyx_TraceLine(589,0,__PYX_ERR(2, 589, __pyx_L1_error))
12070 __Pyx_XDECREF(__pyx_r);
12071 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error)
12072 __Pyx_GOTREF(__pyx_t_1);
12073 __pyx_r = __pyx_t_1;
12087 __Pyx_XDECREF(__pyx_t_1);
12088 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12091 __Pyx_XGIVEREF(__pyx_r);
12092 __Pyx_TraceReturn(__pyx_r, 0);
12093 __Pyx_RefNannyFinishContext();
12106 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
12107 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
12108 PyObject *__pyx_r = 0;
12109 __Pyx_RefNannyDeclarations
12110 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12111 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12114 __Pyx_RefNannyFinishContext();
12118 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12119 PyObject *__pyx_r = NULL;
12120 __Pyx_TraceDeclarations
12121 __Pyx_RefNannyDeclarations
12122 PyObject *__pyx_t_1 = NULL;
12123 PyObject *__pyx_t_2 = NULL;
12124 PyObject *__pyx_t_3 = NULL;
12125 int __pyx_lineno = 0;
12126 const char *__pyx_filename = NULL;
12127 int __pyx_clineno = 0;
12128 __Pyx_RefNannySetupContext(
"__get__", 0);
12129 __Pyx_TraceCall(
"__get__", __pyx_f[2], 592, 0, __PYX_ERR(2, 592, __pyx_L1_error));
12138 __Pyx_TraceLine(593,0,__PYX_ERR(2, 593, __pyx_L1_error))
12139 __Pyx_XDECREF(__pyx_r);
12140 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error)
12141 __Pyx_GOTREF(__pyx_t_1);
12142 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error)
12143 __Pyx_GOTREF(__pyx_t_2);
12144 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error)
12145 __Pyx_GOTREF(__pyx_t_3);
12146 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12147 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12148 __pyx_r = __pyx_t_3;
12162 __Pyx_XDECREF(__pyx_t_1);
12163 __Pyx_XDECREF(__pyx_t_2);
12164 __Pyx_XDECREF(__pyx_t_3);
12165 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12168 __Pyx_XGIVEREF(__pyx_r);
12169 __Pyx_TraceReturn(__pyx_r, 0);
12170 __Pyx_RefNannyFinishContext();
12183 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
12184 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
12185 PyObject *__pyx_r = 0;
12186 __Pyx_RefNannyDeclarations
12187 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12188 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12191 __Pyx_RefNannyFinishContext();
12195 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12196 PyObject *__pyx_v_result = NULL;
12197 PyObject *__pyx_v_length = NULL;
12198 PyObject *__pyx_r = NULL;
12199 __Pyx_TraceDeclarations
12200 __Pyx_RefNannyDeclarations
12203 Py_ssize_t *__pyx_t_3;
12204 Py_ssize_t *__pyx_t_4;
12205 Py_ssize_t *__pyx_t_5;
12206 PyObject *__pyx_t_6 = NULL;
12207 int __pyx_lineno = 0;
12208 const char *__pyx_filename = NULL;
12209 int __pyx_clineno = 0;
12210 __Pyx_RefNannySetupContext(
"__get__", 0);
12211 __Pyx_TraceCall(
"__get__", __pyx_f[2], 596, 0, __PYX_ERR(2, 596, __pyx_L1_error));
12220 __Pyx_TraceLine(597,0,__PYX_ERR(2, 597, __pyx_L1_error))
12221 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
12222 __pyx_t_2 = (__pyx_t_1 != 0);
12232 __Pyx_TraceLine(598,0,__PYX_ERR(2, 598, __pyx_L1_error))
12233 __Pyx_INCREF(__pyx_int_1);
12234 __pyx_v_result = __pyx_int_1;
12243 __Pyx_TraceLine(600,0,__PYX_ERR(2, 600, __pyx_L1_error))
12244 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12245 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12246 __pyx_t_3 = __pyx_t_5;
12247 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error)
12248 __Pyx_GOTREF(__pyx_t_6);
12249 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
12259 __Pyx_TraceLine(601,0,__PYX_ERR(2, 601, __pyx_L1_error))
12260 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error)
12261 __Pyx_GOTREF(__pyx_t_6);
12262 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
12273 __Pyx_TraceLine(603,0,__PYX_ERR(2, 603, __pyx_L1_error))
12274 __Pyx_INCREF(__pyx_v_result);
12275 __Pyx_GIVEREF(__pyx_v_result);
12276 __Pyx_GOTREF(__pyx_v_self->_size);
12277 __Pyx_DECREF(__pyx_v_self->_size);
12278 __pyx_v_self->_size = __pyx_v_result;
12296 __Pyx_TraceLine(605,0,__PYX_ERR(2, 605, __pyx_L1_error))
12297 __Pyx_XDECREF(__pyx_r);
12298 __Pyx_INCREF(__pyx_v_self->_size);
12299 __pyx_r = __pyx_v_self->_size;
12312 __Pyx_XDECREF(__pyx_t_6);
12313 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12316 __Pyx_XDECREF(__pyx_v_result);
12317 __Pyx_XDECREF(__pyx_v_length);
12318 __Pyx_XGIVEREF(__pyx_r);
12319 __Pyx_TraceReturn(__pyx_r, 0);
12320 __Pyx_RefNannyFinishContext();
12333 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
12334 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
12335 Py_ssize_t __pyx_r;
12336 __Pyx_RefNannyDeclarations
12337 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
12338 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12341 __Pyx_RefNannyFinishContext();
12345 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12346 Py_ssize_t __pyx_r;
12347 __Pyx_TraceDeclarations
12348 __Pyx_RefNannyDeclarations
12350 int __pyx_lineno = 0;
12351 const char *__pyx_filename = NULL;
12352 int __pyx_clineno = 0;
12353 __Pyx_RefNannySetupContext(
"__len__", 0);
12354 __Pyx_TraceCall(
"__len__", __pyx_f[2], 607, 0, __PYX_ERR(2, 607, __pyx_L1_error));
12363 __Pyx_TraceLine(608,0,__PYX_ERR(2, 608, __pyx_L1_error))
12364 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
12374 __Pyx_TraceLine(609,0,__PYX_ERR(2, 609, __pyx_L1_error))
12375 __pyx_r = (__pyx_v_self->view.shape[0]);
12394 __Pyx_TraceLine(611,0,__PYX_ERR(2, 611, __pyx_L1_error))
12408 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12411 __Pyx_TraceReturn(Py_None, 0);
12412 __Pyx_RefNannyFinishContext();
12425 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
12426 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
12427 PyObject *__pyx_r = 0;
12428 __Pyx_RefNannyDeclarations
12429 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
12430 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12433 __Pyx_RefNannyFinishContext();
12437 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12438 PyObject *__pyx_r = NULL;
12439 __Pyx_TraceDeclarations
12440 __Pyx_RefNannyDeclarations
12441 PyObject *__pyx_t_1 = NULL;
12442 PyObject *__pyx_t_2 = NULL;
12443 PyObject *__pyx_t_3 = NULL;
12444 int __pyx_lineno = 0;
12445 const char *__pyx_filename = NULL;
12446 int __pyx_clineno = 0;
12447 __Pyx_RefNannySetupContext(
"__repr__", 0);
12448 __Pyx_TraceCall(
"__repr__", __pyx_f[2], 613, 0, __PYX_ERR(2, 613, __pyx_L1_error));
12457 __Pyx_TraceLine(614,0,__PYX_ERR(2, 614, __pyx_L1_error))
12458 __Pyx_XDECREF(__pyx_r);
12459 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error)
12460 __Pyx_GOTREF(__pyx_t_1);
12461 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error)
12462 __Pyx_GOTREF(__pyx_t_2);
12463 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12464 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error)
12465 __Pyx_GOTREF(__pyx_t_1);
12466 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12475 __Pyx_TraceLine(615,0,__PYX_ERR(2, 615, __pyx_L1_error))
12476 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error)
12477 __Pyx_GOTREF(__pyx_t_2);
12486 __Pyx_TraceLine(614,0,__PYX_ERR(2, 614, __pyx_L1_error))
12487 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error)
12488 __Pyx_GOTREF(__pyx_t_3);
12489 __Pyx_GIVEREF(__pyx_t_1);
12490 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
12491 __Pyx_GIVEREF(__pyx_t_2);
12492 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
12495 __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error)
12496 __Pyx_GOTREF(__pyx_t_2);
12497 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12498 __pyx_r = __pyx_t_2;
12512 __Pyx_XDECREF(__pyx_t_1);
12513 __Pyx_XDECREF(__pyx_t_2);
12514 __Pyx_XDECREF(__pyx_t_3);
12515 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12518 __Pyx_XGIVEREF(__pyx_r);
12519 __Pyx_TraceReturn(__pyx_r, 0);
12520 __Pyx_RefNannyFinishContext();
12533 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
12534 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
12535 PyObject *__pyx_r = 0;
12536 __Pyx_RefNannyDeclarations
12537 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
12538 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12541 __Pyx_RefNannyFinishContext();
12545 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12546 PyObject *__pyx_r = NULL;
12547 __Pyx_TraceDeclarations
12548 __Pyx_RefNannyDeclarations
12549 PyObject *__pyx_t_1 = NULL;
12550 PyObject *__pyx_t_2 = NULL;
12551 int __pyx_lineno = 0;
12552 const char *__pyx_filename = NULL;
12553 int __pyx_clineno = 0;
12554 __Pyx_RefNannySetupContext(
"__str__", 0);
12555 __Pyx_TraceCall(
"__str__", __pyx_f[2], 617, 0, __PYX_ERR(2, 617, __pyx_L1_error));
12564 __Pyx_TraceLine(618,0,__PYX_ERR(2, 618, __pyx_L1_error))
12565 __Pyx_XDECREF(__pyx_r);
12566 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
12567 __Pyx_GOTREF(__pyx_t_1);
12568 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error)
12569 __Pyx_GOTREF(__pyx_t_2);
12570 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12571 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
12572 __Pyx_GOTREF(__pyx_t_1);
12573 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12574 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error)
12575 __Pyx_GOTREF(__pyx_t_2);
12576 __Pyx_GIVEREF(__pyx_t_1);
12577 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
12579 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
12580 __Pyx_GOTREF(__pyx_t_1);
12581 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12582 __pyx_r = __pyx_t_1;
12596 __Pyx_XDECREF(__pyx_t_1);
12597 __Pyx_XDECREF(__pyx_t_2);
12598 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12601 __Pyx_XGIVEREF(__pyx_r);
12602 __Pyx_TraceReturn(__pyx_r, 0);
12603 __Pyx_RefNannyFinishContext();
12616 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12617 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_17is_c_contig = {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0};
12618 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12619 PyObject *__pyx_r = 0;
12620 __Pyx_RefNannyDeclarations
12621 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
12622 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12625 __Pyx_RefNannyFinishContext();
12629 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
12630 __Pyx_memviewslice *__pyx_v_mslice;
12631 __Pyx_memviewslice __pyx_v_tmp;
12632 PyObject *__pyx_r = NULL;
12633 __Pyx_TraceDeclarations
12634 __Pyx_RefNannyDeclarations
12635 __Pyx_memviewslice *__pyx_t_1;
12636 PyObject *__pyx_t_2 = NULL;
12637 int __pyx_lineno = 0;
12638 const char *__pyx_filename = NULL;
12639 int __pyx_clineno = 0;
12640 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
12641 __Pyx_TraceCall(
"is_c_contig", __pyx_f[2], 621, 0, __PYX_ERR(2, 621, __pyx_L1_error));
12650 __Pyx_TraceLine(624,0,__PYX_ERR(2, 624, __pyx_L1_error))
12651 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error)
12652 __pyx_v_mslice = __pyx_t_1;
12661 __Pyx_TraceLine(625,0,__PYX_ERR(2, 625, __pyx_L1_error))
12662 __Pyx_XDECREF(__pyx_r);
12663 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'C', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error)
12664 __Pyx_GOTREF(__pyx_t_2);
12665 __pyx_r = __pyx_t_2;
12679 __Pyx_XDECREF(__pyx_t_2);
12680 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
12683 __Pyx_XGIVEREF(__pyx_r);
12684 __Pyx_TraceReturn(__pyx_r, 0);
12685 __Pyx_RefNannyFinishContext();
12698 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12699 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_19is_f_contig = {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0};
12700 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12701 PyObject *__pyx_r = 0;
12702 __Pyx_RefNannyDeclarations
12703 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
12704 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12707 __Pyx_RefNannyFinishContext();
12711 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
12712 __Pyx_memviewslice *__pyx_v_mslice;
12713 __Pyx_memviewslice __pyx_v_tmp;
12714 PyObject *__pyx_r = NULL;
12715 __Pyx_TraceDeclarations
12716 __Pyx_RefNannyDeclarations
12717 __Pyx_memviewslice *__pyx_t_1;
12718 PyObject *__pyx_t_2 = NULL;
12719 int __pyx_lineno = 0;
12720 const char *__pyx_filename = NULL;
12721 int __pyx_clineno = 0;
12722 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
12723 __Pyx_TraceCall(
"is_f_contig", __pyx_f[2], 627, 0, __PYX_ERR(2, 627, __pyx_L1_error));
12732 __Pyx_TraceLine(630,0,__PYX_ERR(2, 630, __pyx_L1_error))
12733 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error)
12734 __pyx_v_mslice = __pyx_t_1;
12743 __Pyx_TraceLine(631,0,__PYX_ERR(2, 631, __pyx_L1_error))
12744 __Pyx_XDECREF(__pyx_r);
12745 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'F', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error)
12746 __Pyx_GOTREF(__pyx_t_2);
12747 __pyx_r = __pyx_t_2;
12761 __Pyx_XDECREF(__pyx_t_2);
12762 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
12765 __Pyx_XGIVEREF(__pyx_r);
12766 __Pyx_TraceReturn(__pyx_r, 0);
12767 __Pyx_RefNannyFinishContext();
12780 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12781 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_21copy = {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0};
12782 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12783 PyObject *__pyx_r = 0;
12784 __Pyx_RefNannyDeclarations
12785 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
12786 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12789 __Pyx_RefNannyFinishContext();
12793 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
12794 __Pyx_memviewslice __pyx_v_mslice;
12796 PyObject *__pyx_r = NULL;
12797 __Pyx_TraceDeclarations
12798 __Pyx_RefNannyDeclarations
12799 __Pyx_memviewslice __pyx_t_1;
12800 PyObject *__pyx_t_2 = NULL;
12801 int __pyx_lineno = 0;
12802 const char *__pyx_filename = NULL;
12803 int __pyx_clineno = 0;
12804 __Pyx_RefNannySetupContext(
"copy", 0);
12805 __Pyx_TraceCall(
"copy", __pyx_f[2], 633, 0, __PYX_ERR(2, 633, __pyx_L1_error));
12814 __Pyx_TraceLine(635,0,__PYX_ERR(2, 635, __pyx_L1_error))
12815 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
12824 __Pyx_TraceLine(637,0,__PYX_ERR(2, 637, __pyx_L1_error))
12825 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
12834 __Pyx_TraceLine(638,0,__PYX_ERR(2, 638, __pyx_L1_error))
12835 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((
char *)
"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error)
12836 __pyx_v_mslice = __pyx_t_1;
12845 __Pyx_TraceLine(643,0,__PYX_ERR(2, 643, __pyx_L1_error))
12846 __Pyx_XDECREF(__pyx_r);
12847 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error)
12848 __Pyx_GOTREF(__pyx_t_2);
12849 __pyx_r = __pyx_t_2;
12863 __Pyx_XDECREF(__pyx_t_2);
12864 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
12867 __Pyx_XGIVEREF(__pyx_r);
12868 __Pyx_TraceReturn(__pyx_r, 0);
12869 __Pyx_RefNannyFinishContext();
12882 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12883 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_23copy_fortran = {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0};
12884 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12885 PyObject *__pyx_r = 0;
12886 __Pyx_RefNannyDeclarations
12887 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
12888 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12891 __Pyx_RefNannyFinishContext();
12895 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
12896 __Pyx_memviewslice __pyx_v_src;
12897 __Pyx_memviewslice __pyx_v_dst;
12899 PyObject *__pyx_r = NULL;
12900 __Pyx_TraceDeclarations
12901 __Pyx_RefNannyDeclarations
12902 __Pyx_memviewslice __pyx_t_1;
12903 PyObject *__pyx_t_2 = NULL;
12904 int __pyx_lineno = 0;
12905 const char *__pyx_filename = NULL;
12906 int __pyx_clineno = 0;
12907 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
12908 __Pyx_TraceCall(
"copy_fortran", __pyx_f[2], 645, 0, __PYX_ERR(2, 645, __pyx_L1_error));
12917 __Pyx_TraceLine(647,0,__PYX_ERR(2, 647, __pyx_L1_error))
12918 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
12927 __Pyx_TraceLine(649,0,__PYX_ERR(2, 649, __pyx_L1_error))
12928 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
12937 __Pyx_TraceLine(650,0,__PYX_ERR(2, 650, __pyx_L1_error))
12938 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((
char *)
"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error)
12939 __pyx_v_dst = __pyx_t_1;
12948 __Pyx_TraceLine(655,0,__PYX_ERR(2, 655, __pyx_L1_error))
12949 __Pyx_XDECREF(__pyx_r);
12950 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error)
12951 __Pyx_GOTREF(__pyx_t_2);
12952 __pyx_r = __pyx_t_2;
12966 __Pyx_XDECREF(__pyx_t_2);
12967 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
12970 __Pyx_XGIVEREF(__pyx_r);
12971 __Pyx_TraceReturn(__pyx_r, 0);
12972 __Pyx_RefNannyFinishContext();
12983 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12984 static PyMethodDef __pyx_mdef___pyx_memoryview_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0};
12985 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12986 PyObject *__pyx_r = 0;
12987 __Pyx_RefNannyDeclarations
12988 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
12989 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12992 __Pyx_RefNannyFinishContext();
12996 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
12997 PyObject *__pyx_r = NULL;
12998 __Pyx_TraceDeclarations
12999 __Pyx_RefNannyDeclarations
13000 PyObject *__pyx_t_1 = NULL;
13001 int __pyx_lineno = 0;
13002 const char *__pyx_filename = NULL;
13003 int __pyx_clineno = 0;
13004 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
13005 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
13013 __Pyx_TraceLine(2,0,__PYX_ERR(2, 2, __pyx_L1_error))
13014 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
13015 __Pyx_GOTREF(__pyx_t_1);
13016 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13017 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13018 __PYX_ERR(2, 2, __pyx_L1_error)
13028 __Pyx_XDECREF(__pyx_t_1);
13029 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13031 __Pyx_XGIVEREF(__pyx_r);
13032 __Pyx_TraceReturn(__pyx_r, 0);
13033 __Pyx_RefNannyFinishContext();
13045 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
13046 static PyMethodDef __pyx_mdef___pyx_memoryview_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0};
13047 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
13048 PyObject *__pyx_r = 0;
13049 __Pyx_RefNannyDeclarations
13050 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
13051 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
13054 __Pyx_RefNannyFinishContext();
13058 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
13059 PyObject *__pyx_r = NULL;
13060 __Pyx_TraceDeclarations
13061 __Pyx_RefNannyDeclarations
13062 PyObject *__pyx_t_1 = NULL;
13063 int __pyx_lineno = 0;
13064 const char *__pyx_filename = NULL;
13065 int __pyx_clineno = 0;
13066 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
13067 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[2], 3, 0, __PYX_ERR(2, 3, __pyx_L1_error));
13074 __Pyx_TraceLine(4,0,__PYX_ERR(2, 4, __pyx_L1_error))
13075 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
13076 __Pyx_GOTREF(__pyx_t_1);
13077 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13078 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13079 __PYX_ERR(2, 4, __pyx_L1_error)
13090 __Pyx_XDECREF(__pyx_t_1);
13091 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13093 __Pyx_XGIVEREF(__pyx_r);
13094 __Pyx_TraceReturn(__pyx_r, 0);
13095 __Pyx_RefNannyFinishContext();
13107 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
13108 struct __pyx_memoryview_obj *__pyx_v_result = 0;
13109 PyObject *__pyx_r = NULL;
13110 __Pyx_TraceDeclarations
13111 __Pyx_RefNannyDeclarations
13112 PyObject *__pyx_t_1 = NULL;
13113 PyObject *__pyx_t_2 = NULL;
13114 PyObject *__pyx_t_3 = NULL;
13115 int __pyx_lineno = 0;
13116 const char *__pyx_filename = NULL;
13117 int __pyx_clineno = 0;
13118 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
13119 __Pyx_TraceCall(
"memoryview_cwrapper", __pyx_f[2], 659, 0, __PYX_ERR(2, 659, __pyx_L1_error));
13128 __Pyx_TraceLine(660,0,__PYX_ERR(2, 660, __pyx_L1_error))
13129 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error)
13130 __Pyx_GOTREF(__pyx_t_1);
13131 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error)
13132 __Pyx_GOTREF(__pyx_t_2);
13133 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error)
13134 __Pyx_GOTREF(__pyx_t_3);
13135 __Pyx_INCREF(__pyx_v_o);
13136 __Pyx_GIVEREF(__pyx_v_o);
13137 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
13138 __Pyx_GIVEREF(__pyx_t_1);
13139 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
13140 __Pyx_GIVEREF(__pyx_t_2);
13141 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
13144 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error)
13145 __Pyx_GOTREF(__pyx_t_2);
13146 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13147 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
13157 __Pyx_TraceLine(661,0,__PYX_ERR(2, 661, __pyx_L1_error))
13158 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
13167 __Pyx_TraceLine(662,0,__PYX_ERR(2, 662, __pyx_L1_error))
13168 __Pyx_XDECREF(__pyx_r);
13169 __Pyx_INCREF(((PyObject *)__pyx_v_result));
13170 __pyx_r = ((PyObject *)__pyx_v_result);
13183 __Pyx_XDECREF(__pyx_t_1);
13184 __Pyx_XDECREF(__pyx_t_2);
13185 __Pyx_XDECREF(__pyx_t_3);
13186 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
13189 __Pyx_XDECREF((PyObject *)__pyx_v_result);
13190 __Pyx_XGIVEREF(__pyx_r);
13191 __Pyx_TraceReturn(__pyx_r, 0);
13192 __Pyx_RefNannyFinishContext();
13204 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
13206 __Pyx_TraceDeclarations
13207 __Pyx_RefNannyDeclarations
13209 int __pyx_lineno = 0;
13210 const char *__pyx_filename = NULL;
13211 int __pyx_clineno = 0;
13212 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
13213 __Pyx_TraceCall(
"memoryview_check", __pyx_f[2], 665, 0, __PYX_ERR(2, 665, __pyx_L1_error));
13222 __Pyx_TraceLine(666,0,__PYX_ERR(2, 666, __pyx_L1_error))
13223 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
13224 __pyx_r = __pyx_t_1;
13237 __Pyx_WriteUnraisable(
"View.MemoryView.memoryview_check", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
13240 __Pyx_TraceReturn(Py_None, 0);
13241 __Pyx_RefNannyFinishContext();
13253 static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
13254 PyObject *__pyx_v_tup = NULL;
13255 PyObject *__pyx_v_result = NULL;
13256 int __pyx_v_have_slices;
13257 int __pyx_v_seen_ellipsis;
13258 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
13259 PyObject *__pyx_v_item = NULL;
13260 Py_ssize_t __pyx_v_nslices;
13261 PyObject *__pyx_r = NULL;
13262 __Pyx_TraceDeclarations
13263 __Pyx_RefNannyDeclarations
13266 PyObject *__pyx_t_3 = NULL;
13267 PyObject *__pyx_t_4 = NULL;
13268 Py_ssize_t __pyx_t_5;
13269 PyObject *(*__pyx_t_6)(PyObject *);
13270 PyObject *__pyx_t_7 = NULL;
13271 Py_ssize_t __pyx_t_8;
13274 PyObject *__pyx_t_11 = NULL;
13275 int __pyx_lineno = 0;
13276 const char *__pyx_filename = NULL;
13277 int __pyx_clineno = 0;
13278 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
13279 __Pyx_TraceCall(
"_unellipsify", __pyx_f[2], 668, 0, __PYX_ERR(2, 668, __pyx_L1_error));
13288 __Pyx_TraceLine(673,0,__PYX_ERR(2, 673, __pyx_L1_error))
13289 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
13290 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13300 __Pyx_TraceLine(674,0,__PYX_ERR(2, 674, __pyx_L1_error))
13301 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error)
13302 __Pyx_GOTREF(__pyx_t_3);
13303 __Pyx_INCREF(__pyx_v_index);
13304 __Pyx_GIVEREF(__pyx_v_index);
13305 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
13306 __pyx_v_tup = __pyx_t_3;
13326 __Pyx_TraceLine(676,0,__PYX_ERR(2, 676, __pyx_L1_error))
13328 __Pyx_INCREF(__pyx_v_index);
13329 __pyx_v_tup = __pyx_v_index;
13340 __Pyx_TraceLine(678,0,__PYX_ERR(2, 678, __pyx_L1_error))
13341 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error)
13342 __Pyx_GOTREF(__pyx_t_3);
13343 __pyx_v_result = ((PyObject*)__pyx_t_3);
13353 __Pyx_TraceLine(679,0,__PYX_ERR(2, 679, __pyx_L1_error))
13354 __pyx_v_have_slices = 0;
13363 __Pyx_TraceLine(680,0,__PYX_ERR(2, 680, __pyx_L1_error))
13364 __pyx_v_seen_ellipsis = 0;
13373 __Pyx_TraceLine(681,0,__PYX_ERR(2, 681, __pyx_L1_error))
13374 __Pyx_INCREF(__pyx_int_0);
13375 __pyx_t_3 = __pyx_int_0;
13376 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
13377 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
13380 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error)
13381 __Pyx_GOTREF(__pyx_t_4);
13382 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error)
13385 if (likely(!__pyx_t_6)) {
13386 if (likely(PyList_CheckExact(__pyx_t_4))) {
13387 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
13388 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13389 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error)
13391 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
13392 __Pyx_GOTREF(__pyx_t_7);
13395 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
13396 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13397 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error)
13399 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
13400 __Pyx_GOTREF(__pyx_t_7);
13404 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
13405 if (unlikely(!__pyx_t_7)) {
13406 PyObject* exc_type = PyErr_Occurred();
13408 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13409 else __PYX_ERR(2, 681, __pyx_L1_error)
13413 __Pyx_GOTREF(__pyx_t_7);
13415 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
13417 __Pyx_INCREF(__pyx_t_3);
13418 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
13419 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
13420 __Pyx_GOTREF(__pyx_t_7);
13421 __Pyx_DECREF(__pyx_t_3);
13422 __pyx_t_3 = __pyx_t_7;
13432 __Pyx_TraceLine(682,0,__PYX_ERR(2, 682, __pyx_L1_error))
13433 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
13434 __pyx_t_1 = (__pyx_t_2 != 0);
13444 __Pyx_TraceLine(683,0,__PYX_ERR(2, 683, __pyx_L1_error))
13445 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
13455 __Pyx_TraceLine(684,0,__PYX_ERR(2, 684, __pyx_L1_error))
13456 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error)
13457 __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error)
13458 __Pyx_GOTREF(__pyx_t_7);
13459 { Py_ssize_t __pyx_temp;
13460 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
13461 __Pyx_INCREF(__pyx_slice__17);
13462 __Pyx_GIVEREF(__pyx_slice__17);
13463 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__17);
13466 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 684, __pyx_L1_error)
13467 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13476 __Pyx_TraceLine(685,0,__PYX_ERR(2, 685, __pyx_L1_error))
13477 __pyx_v_seen_ellipsis = 1;
13496 __Pyx_TraceLine(687,0,__PYX_ERR(2, 687, __pyx_L1_error))
13498 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__17);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 687, __pyx_L1_error)
13509 __Pyx_TraceLine(688,0,__PYX_ERR(2, 688, __pyx_L1_error))
13510 __pyx_v_have_slices = 1;
13529 __Pyx_TraceLine(690,0,__PYX_ERR(2, 690, __pyx_L1_error))
13531 __pyx_t_2 = PySlice_Check(__pyx_v_item);
13532 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
13535 __pyx_t_1 = __pyx_t_10;
13536 goto __pyx_L9_bool_binop_done;
13538 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
13539 __pyx_t_1 = __pyx_t_10;
13540 __pyx_L9_bool_binop_done:;
13541 if (unlikely(__pyx_t_1)) {
13550 __Pyx_TraceLine(691,0,__PYX_ERR(2, 691, __pyx_L1_error))
13551 __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error)
13552 __Pyx_GOTREF(__pyx_t_7);
13553 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error)
13554 __Pyx_GOTREF(__pyx_t_11);
13555 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13556 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
13557 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
13558 __PYX_ERR(2, 691, __pyx_L1_error)
13576 __Pyx_TraceLine(693,0,__PYX_ERR(2, 693, __pyx_L1_error))
13577 __pyx_t_10 = (__pyx_v_have_slices != 0);
13580 __pyx_t_1 = __pyx_t_10;
13581 goto __pyx_L11_bool_binop_done;
13583 __pyx_t_10 = PySlice_Check(__pyx_v_item);
13584 __pyx_t_2 = (__pyx_t_10 != 0);
13585 __pyx_t_1 = __pyx_t_2;
13586 __pyx_L11_bool_binop_done:;
13587 __pyx_v_have_slices = __pyx_t_1;
13596 __Pyx_TraceLine(694,0,__PYX_ERR(2, 694, __pyx_L1_error))
13597 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
13608 __Pyx_TraceLine(681,0,__PYX_ERR(2, 681, __pyx_L1_error))
13610 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13611 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13620 __Pyx_TraceLine(696,0,__PYX_ERR(2, 696, __pyx_L1_error))
13621 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result);
if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
13622 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
13631 __Pyx_TraceLine(697,0,__PYX_ERR(2, 697, __pyx_L1_error))
13632 __pyx_t_1 = (__pyx_v_nslices != 0);
13642 __Pyx_TraceLine(698,0,__PYX_ERR(2, 698, __pyx_L1_error))
13643 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error)
13644 __Pyx_GOTREF(__pyx_t_3);
13645 { Py_ssize_t __pyx_temp;
13646 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
13647 __Pyx_INCREF(__pyx_slice__17);
13648 __Pyx_GIVEREF(__pyx_slice__17);
13649 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__17);
13652 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 698, __pyx_L1_error)
13653 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13671 __Pyx_TraceLine(700,0,__PYX_ERR(2, 700, __pyx_L1_error))
13672 __Pyx_XDECREF(__pyx_r);
13673 if (!__pyx_v_have_slices) {
13675 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
13676 __Pyx_GOTREF(__pyx_t_4);
13677 __pyx_t_3 = __pyx_t_4;
13679 goto __pyx_L14_bool_binop_done;
13681 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
13682 __Pyx_GOTREF(__pyx_t_4);
13683 __pyx_t_3 = __pyx_t_4;
13685 __pyx_L14_bool_binop_done:;
13686 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
13687 __Pyx_GOTREF(__pyx_t_4);
13688 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error)
13689 __Pyx_GOTREF(__pyx_t_11);
13690 __Pyx_GIVEREF(__pyx_t_3);
13691 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
13692 __Pyx_GIVEREF(__pyx_t_4);
13693 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
13696 __pyx_r = ((PyObject*)__pyx_t_11);
13710 __Pyx_XDECREF(__pyx_t_3);
13711 __Pyx_XDECREF(__pyx_t_4);
13712 __Pyx_XDECREF(__pyx_t_7);
13713 __Pyx_XDECREF(__pyx_t_11);
13714 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
13717 __Pyx_XDECREF(__pyx_v_tup);
13718 __Pyx_XDECREF(__pyx_v_result);
13719 __Pyx_XDECREF(__pyx_v_idx);
13720 __Pyx_XDECREF(__pyx_v_item);
13721 __Pyx_XGIVEREF(__pyx_r);
13722 __Pyx_TraceReturn(__pyx_r, 0);
13723 __Pyx_RefNannyFinishContext();
13735 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
13736 Py_ssize_t __pyx_v_suboffset;
13737 PyObject *__pyx_r = NULL;
13738 __Pyx_TraceDeclarations
13739 __Pyx_RefNannyDeclarations
13740 Py_ssize_t *__pyx_t_1;
13741 Py_ssize_t *__pyx_t_2;
13742 Py_ssize_t *__pyx_t_3;
13744 PyObject *__pyx_t_5 = NULL;
13745 int __pyx_lineno = 0;
13746 const char *__pyx_filename = NULL;
13747 int __pyx_clineno = 0;
13748 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
13749 __Pyx_TraceCall(
"assert_direct_dimensions", __pyx_f[2], 702, 0, __PYX_ERR(2, 702, __pyx_L1_error));
13758 __Pyx_TraceLine(703,0,__PYX_ERR(2, 703, __pyx_L1_error))
13759 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
13760 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
13761 __pyx_t_1 = __pyx_t_3;
13762 __pyx_v_suboffset = (__pyx_t_1[0]);
13771 __Pyx_TraceLine(704,0,__PYX_ERR(2, 704, __pyx_L1_error))
13772 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
13773 if (unlikely(__pyx_t_4)) {
13782 __Pyx_TraceLine(705,0,__PYX_ERR(2, 705, __pyx_L1_error))
13783 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error)
13784 __Pyx_GOTREF(__pyx_t_5);
13785 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
13786 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13787 __PYX_ERR(2, 705, __pyx_L1_error)
13808 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13811 __Pyx_XDECREF(__pyx_t_5);
13812 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
13815 __Pyx_XGIVEREF(__pyx_r);
13816 __Pyx_TraceReturn(__pyx_r, 0);
13817 __Pyx_RefNannyFinishContext();
13829 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
13830 int __pyx_v_new_ndim;
13831 int __pyx_v_suboffset_dim;
13833 __Pyx_memviewslice __pyx_v_src;
13834 __Pyx_memviewslice __pyx_v_dst;
13835 __Pyx_memviewslice *__pyx_v_p_src;
13836 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
13837 __Pyx_memviewslice *__pyx_v_p_dst;
13838 int *__pyx_v_p_suboffset_dim;
13839 Py_ssize_t __pyx_v_start;
13840 Py_ssize_t __pyx_v_stop;
13841 Py_ssize_t __pyx_v_step;
13842 int __pyx_v_have_start;
13843 int __pyx_v_have_stop;
13844 int __pyx_v_have_step;
13845 PyObject *__pyx_v_index = NULL;
13846 struct __pyx_memoryview_obj *__pyx_r = NULL;
13847 __Pyx_TraceDeclarations
13848 __Pyx_RefNannyDeclarations
13851 PyObject *__pyx_t_3 = NULL;
13852 struct __pyx_memoryview_obj *__pyx_t_4;
13855 Py_ssize_t __pyx_t_7;
13856 PyObject *(*__pyx_t_8)(PyObject *);
13857 PyObject *__pyx_t_9 = NULL;
13858 Py_ssize_t __pyx_t_10;
13860 Py_ssize_t __pyx_t_12;
13861 int __pyx_lineno = 0;
13862 const char *__pyx_filename = NULL;
13863 int __pyx_clineno = 0;
13864 __Pyx_RefNannySetupContext(
"memview_slice", 0);
13865 __Pyx_TraceCall(
"memview_slice", __pyx_f[2], 712, 0, __PYX_ERR(2, 712, __pyx_L1_error));
13874 __Pyx_TraceLine(713,0,__PYX_ERR(2, 713, __pyx_L1_error))
13875 __pyx_v_new_ndim = 0;
13876 __pyx_v_suboffset_dim = -1;
13885 __Pyx_TraceLine(720,0,__PYX_ERR(2, 720, __pyx_L1_error))
13886 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
13895 __Pyx_TraceLine(724,0,__PYX_ERR(2, 724, __pyx_L1_error))
13896 #ifndef CYTHON_WITHOUT_ASSERTIONS
13897 if (unlikely(__pyx_assertions_enabled())) {
13898 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
13899 PyErr_SetNone(PyExc_AssertionError);
13900 __PYX_ERR(2, 724, __pyx_L1_error)
13912 __Pyx_TraceLine(726,0,__PYX_ERR(2, 726, __pyx_L1_error))
13913 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
13914 __pyx_t_2 = (__pyx_t_1 != 0);
13924 __Pyx_TraceLine(727,0,__PYX_ERR(2, 727, __pyx_L1_error))
13925 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error)
13926 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
13927 __Pyx_INCREF(__pyx_t_3);
13928 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
13938 __Pyx_TraceLine(728,0,__PYX_ERR(2, 728, __pyx_L1_error))
13939 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
13958 __Pyx_TraceLine(730,0,__PYX_ERR(2, 730, __pyx_L1_error))
13960 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
13969 __Pyx_TraceLine(731,0,__PYX_ERR(2, 731, __pyx_L1_error))
13970 __pyx_v_p_src = (&__pyx_v_src);
13981 __Pyx_TraceLine(737,0,__PYX_ERR(2, 737, __pyx_L1_error))
13982 __pyx_t_4 = __pyx_v_p_src->memview;
13983 __pyx_v_dst.memview = __pyx_t_4;
13992 __Pyx_TraceLine(738,0,__PYX_ERR(2, 738, __pyx_L1_error))
13993 __pyx_t_5 = __pyx_v_p_src->data;
13994 __pyx_v_dst.data = __pyx_t_5;
14003 __Pyx_TraceLine(743,0,__PYX_ERR(2, 743, __pyx_L1_error))
14004 __pyx_v_p_dst = (&__pyx_v_dst);
14013 __Pyx_TraceLine(744,0,__PYX_ERR(2, 744, __pyx_L1_error))
14014 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
14023 __Pyx_TraceLine(748,0,__PYX_ERR(2, 748, __pyx_L1_error))
14025 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
14026 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
14029 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error)
14030 __Pyx_GOTREF(__pyx_t_3);
14031 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error)
14034 if (likely(!__pyx_t_8)) {
14035 if (likely(PyList_CheckExact(__pyx_t_3))) {
14036 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
14037 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14038 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error)
14040 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error)
14041 __Pyx_GOTREF(__pyx_t_9);
14044 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
14045 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14046 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error)
14048 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error)
14049 __Pyx_GOTREF(__pyx_t_9);
14053 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
14054 if (unlikely(!__pyx_t_9)) {
14055 PyObject* exc_type = PyErr_Occurred();
14057 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14058 else __PYX_ERR(2, 748, __pyx_L1_error)
14062 __Pyx_GOTREF(__pyx_t_9);
14064 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
14066 __pyx_v_dim = __pyx_t_6;
14067 __pyx_t_6 = (__pyx_t_6 + 1);
14076 __Pyx_TraceLine(749,0,__PYX_ERR(2, 749, __pyx_L1_error))
14077 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
14087 __Pyx_TraceLine(753,0,__PYX_ERR(2, 753, __pyx_L1_error))
14088 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index);
if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error)
14097 __Pyx_TraceLine(750,0,__PYX_ERR(2, 750, __pyx_L1_error))
14098 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(2, 750, __pyx_L1_error)
14117 __Pyx_TraceLine(756,0,__PYX_ERR(2, 756, __pyx_L1_error))
14118 __pyx_t_2 = (__pyx_v_index == Py_None);
14119 __pyx_t_1 = (__pyx_t_2 != 0);
14129 __Pyx_TraceLine(757,0,__PYX_ERR(2, 757, __pyx_L1_error))
14130 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
14139 __Pyx_TraceLine(758,0,__PYX_ERR(2, 758, __pyx_L1_error))
14140 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
14149 __Pyx_TraceLine(759,0,__PYX_ERR(2, 759, __pyx_L1_error))
14150 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
14159 __Pyx_TraceLine(760,0,__PYX_ERR(2, 760, __pyx_L1_error))
14160 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14179 __Pyx_TraceLine(762,0,__PYX_ERR(2, 762, __pyx_L1_error))
14181 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
14182 __Pyx_GOTREF(__pyx_t_9);
14183 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
14185 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14187 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
14188 __pyx_t_10 = __pyx_t_12;
14189 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14190 goto __pyx_L7_bool_binop_done;
14193 __pyx_L7_bool_binop_done:;
14194 __pyx_v_start = __pyx_t_10;
14203 __Pyx_TraceLine(763,0,__PYX_ERR(2, 763, __pyx_L1_error))
14204 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error)
14205 __Pyx_GOTREF(__pyx_t_9);
14206 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error)
14208 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14210 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error)
14211 __pyx_t_10 = __pyx_t_12;
14212 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14213 goto __pyx_L9_bool_binop_done;
14216 __pyx_L9_bool_binop_done:;
14217 __pyx_v_stop = __pyx_t_10;
14226 __Pyx_TraceLine(764,0,__PYX_ERR(2, 764, __pyx_L1_error))
14227 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
14228 __Pyx_GOTREF(__pyx_t_9);
14229 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error)
14231 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14233 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error)
14234 __pyx_t_10 = __pyx_t_12;
14235 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14236 goto __pyx_L11_bool_binop_done;
14239 __pyx_L11_bool_binop_done:;
14240 __pyx_v_step = __pyx_t_10;
14249 __Pyx_TraceLine(766,0,__PYX_ERR(2, 766, __pyx_L1_error))
14250 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
14251 __Pyx_GOTREF(__pyx_t_9);
14252 __pyx_t_1 = (__pyx_t_9 != Py_None);
14253 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14254 __pyx_v_have_start = __pyx_t_1;
14263 __Pyx_TraceLine(767,0,__PYX_ERR(2, 767, __pyx_L1_error))
14264 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error)
14265 __Pyx_GOTREF(__pyx_t_9);
14266 __pyx_t_1 = (__pyx_t_9 != Py_None);
14267 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14268 __pyx_v_have_stop = __pyx_t_1;
14277 __Pyx_TraceLine(768,0,__PYX_ERR(2, 768, __pyx_L1_error))
14278 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error)
14279 __Pyx_GOTREF(__pyx_t_9);
14280 __pyx_t_1 = (__pyx_t_9 != Py_None);
14281 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14282 __pyx_v_have_step = __pyx_t_1;
14291 __Pyx_TraceLine(770,0,__PYX_ERR(2, 770, __pyx_L1_error))
14292 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(2, 770, __pyx_L1_error)
14301 __Pyx_TraceLine(776,0,__PYX_ERR(2, 776, __pyx_L1_error))
14302 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14313 __Pyx_TraceLine(748,0,__PYX_ERR(2, 748, __pyx_L1_error))
14315 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14324 __Pyx_TraceLine(778,0,__PYX_ERR(2, 778, __pyx_L1_error))
14325 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14326 __pyx_t_2 = (__pyx_t_1 != 0);
14336 __Pyx_TraceLine(779,0,__PYX_ERR(2, 779, __pyx_L1_error))
14337 __Pyx_XDECREF(((PyObject *)__pyx_r));
14346 __Pyx_TraceLine(780,0,__PYX_ERR(2, 780, __pyx_L1_error))
14347 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) }
14356 __Pyx_TraceLine(781,0,__PYX_ERR(2, 781, __pyx_L1_error))
14357 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) }
14366 __Pyx_TraceLine(779,0,__PYX_ERR(2, 779, __pyx_L1_error))
14367 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error)
14368 __Pyx_GOTREF(__pyx_t_3);
14369 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error)
14370 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
14390 __Pyx_TraceLine(784,0,__PYX_ERR(2, 784, __pyx_L1_error))
14392 __Pyx_XDECREF(((PyObject *)__pyx_r));
14401 __Pyx_TraceLine(785,0,__PYX_ERR(2, 785, __pyx_L1_error))
14402 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error)
14403 __Pyx_GOTREF(__pyx_t_3);
14412 __Pyx_TraceLine(784,0,__PYX_ERR(2, 784, __pyx_L1_error))
14413 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error)
14414 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
14429 __Pyx_XDECREF(__pyx_t_3);
14430 __Pyx_XDECREF(__pyx_t_9);
14431 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14434 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
14435 __Pyx_XDECREF(__pyx_v_index);
14436 __Pyx_XGIVEREF((PyObject *)__pyx_r);
14437 __Pyx_TraceReturn(__pyx_r, 0);
14438 __Pyx_RefNannyFinishContext();
14450 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset,
int __pyx_v_dim,
int __pyx_v_new_ndim,
int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step,
int __pyx_v_have_start,
int __pyx_v_have_stop,
int __pyx_v_have_step,
int __pyx_v_is_slice) {
14451 Py_ssize_t __pyx_v_new_shape;
14452 int __pyx_v_negative_step;
14454 __Pyx_TraceDeclarations
14458 int __pyx_lineno = 0;
14459 const char *__pyx_filename = NULL;
14460 int __pyx_clineno = 0;
14461 __Pyx_TraceCall(
"slice_memviewslice", __pyx_f[2], 809, 1, __PYX_ERR(2, 809, __pyx_L1_error));
14470 __Pyx_TraceLine(829,1,__PYX_ERR(2, 829, __pyx_L1_error))
14471 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
14481 __Pyx_TraceLine(831,1,__PYX_ERR(2, 831, __pyx_L1_error))
14482 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
14492 __Pyx_TraceLine(832,1,__PYX_ERR(2, 832, __pyx_L1_error))
14493 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14511 __Pyx_TraceLine(833,1,__PYX_ERR(2, 833, __pyx_L1_error))
14512 __pyx_t_1 = (0 <= __pyx_v_start);
14514 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
14516 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14526 __Pyx_TraceLine(834,1,__PYX_ERR(2, 834, __pyx_L1_error))
14527 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"Index out of bounds (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 834, __pyx_L1_error)
14555 __Pyx_TraceLine(837,1,__PYX_ERR(2, 837, __pyx_L1_error))
14557 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
14560 __pyx_t_2 = __pyx_t_1;
14561 goto __pyx_L6_bool_binop_done;
14563 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
14564 __pyx_t_2 = __pyx_t_1;
14565 __pyx_L6_bool_binop_done:;
14566 __pyx_v_negative_step = __pyx_t_2;
14575 __Pyx_TraceLine(839,1,__PYX_ERR(2, 839, __pyx_L1_error))
14576 __pyx_t_1 = (__pyx_v_have_step != 0);
14579 __pyx_t_2 = __pyx_t_1;
14580 goto __pyx_L9_bool_binop_done;
14582 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
14583 __pyx_t_2 = __pyx_t_1;
14584 __pyx_L9_bool_binop_done:;
14594 __Pyx_TraceLine(840,1,__PYX_ERR(2, 840, __pyx_L1_error))
14595 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Step may not be zero (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 840, __pyx_L1_error)
14613 __Pyx_TraceLine(843,1,__PYX_ERR(2, 843, __pyx_L1_error))
14614 __pyx_t_2 = (__pyx_v_have_start != 0);
14624 __Pyx_TraceLine(844,1,__PYX_ERR(2, 844, __pyx_L1_error))
14625 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
14635 __Pyx_TraceLine(845,1,__PYX_ERR(2, 845, __pyx_L1_error))
14636 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14645 __Pyx_TraceLine(846,1,__PYX_ERR(2, 846, __pyx_L1_error))
14646 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
14656 __Pyx_TraceLine(847,1,__PYX_ERR(2, 847, __pyx_L1_error))
14685 __Pyx_TraceLine(848,1,__PYX_ERR(2, 848, __pyx_L1_error))
14686 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
14696 __Pyx_TraceLine(849,1,__PYX_ERR(2, 849, __pyx_L1_error))
14697 __pyx_t_2 = (__pyx_v_negative_step != 0);
14707 __Pyx_TraceLine(850,1,__PYX_ERR(2, 850, __pyx_L1_error))
14708 __pyx_v_start = (__pyx_v_shape - 1);
14727 __Pyx_TraceLine(852,1,__PYX_ERR(2, 852, __pyx_L1_error))
14729 __pyx_v_start = __pyx_v_shape;
14760 __Pyx_TraceLine(854,1,__PYX_ERR(2, 854, __pyx_L1_error))
14762 __pyx_t_2 = (__pyx_v_negative_step != 0);
14772 __Pyx_TraceLine(855,1,__PYX_ERR(2, 855, __pyx_L1_error))
14773 __pyx_v_start = (__pyx_v_shape - 1);
14792 __Pyx_TraceLine(857,1,__PYX_ERR(2, 857, __pyx_L1_error))
14807 __Pyx_TraceLine(859,1,__PYX_ERR(2, 859, __pyx_L1_error))
14808 __pyx_t_2 = (__pyx_v_have_stop != 0);
14818 __Pyx_TraceLine(860,1,__PYX_ERR(2, 860, __pyx_L1_error))
14819 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
14829 __Pyx_TraceLine(861,1,__PYX_ERR(2, 861, __pyx_L1_error))
14830 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
14839 __Pyx_TraceLine(862,1,__PYX_ERR(2, 862, __pyx_L1_error))
14840 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
14850 __Pyx_TraceLine(863,1,__PYX_ERR(2, 863, __pyx_L1_error))
14879 __Pyx_TraceLine(864,1,__PYX_ERR(2, 864, __pyx_L1_error))
14880 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
14890 __Pyx_TraceLine(865,1,__PYX_ERR(2, 865, __pyx_L1_error))
14891 __pyx_v_stop = __pyx_v_shape;
14920 __Pyx_TraceLine(867,1,__PYX_ERR(2, 867, __pyx_L1_error))
14922 __pyx_t_2 = (__pyx_v_negative_step != 0);
14932 __Pyx_TraceLine(868,1,__PYX_ERR(2, 868, __pyx_L1_error))
14933 __pyx_v_stop = -1L;
14952 __Pyx_TraceLine(870,1,__PYX_ERR(2, 870, __pyx_L1_error))
14954 __pyx_v_stop = __pyx_v_shape;
14967 __Pyx_TraceLine(872,1,__PYX_ERR(2, 872, __pyx_L1_error))
14968 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
14978 __Pyx_TraceLine(873,1,__PYX_ERR(2, 873, __pyx_L1_error))
14997 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
15006 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
15016 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
15034 __Pyx_TraceLine(882,1,__PYX_ERR(2, 882, __pyx_L1_error))
15035 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
15045 __Pyx_TraceLine(883,1,__PYX_ERR(2, 883, __pyx_L1_error))
15046 __pyx_v_new_shape = 0;
15064 __Pyx_TraceLine(886,1,__PYX_ERR(2, 886, __pyx_L1_error))
15065 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
15074 __Pyx_TraceLine(887,1,__PYX_ERR(2, 887, __pyx_L1_error))
15075 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
15084 __Pyx_TraceLine(888,1,__PYX_ERR(2, 888, __pyx_L1_error))
15085 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
15096 __Pyx_TraceLine(891,1,__PYX_ERR(2, 891, __pyx_L1_error))
15097 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
15107 __Pyx_TraceLine(892,1,__PYX_ERR(2, 892, __pyx_L1_error))
15108 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
15127 __Pyx_TraceLine(894,1,__PYX_ERR(2, 894, __pyx_L1_error))
15129 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
15130 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
15141 __Pyx_TraceLine(896,1,__PYX_ERR(2, 896, __pyx_L1_error))
15142 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15152 __Pyx_TraceLine(897,1,__PYX_ERR(2, 897, __pyx_L1_error))
15153 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
15163 __Pyx_TraceLine(898,1,__PYX_ERR(2, 898, __pyx_L1_error))
15164 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
15174 __Pyx_TraceLine(899,1,__PYX_ERR(2, 899, __pyx_L1_error))
15175 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
15194 __Pyx_TraceLine(901,1,__PYX_ERR(2, 901, __pyx_L1_error))
15204 __Pyx_TraceLine(902,1,__PYX_ERR(2, 902, __pyx_L1_error))
15205 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 901, __pyx_L1_error)
15226 __Pyx_TraceLine(904,1,__PYX_ERR(2, 904, __pyx_L1_error))
15228 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
15248 __Pyx_TraceLine(906,1,__PYX_ERR(2, 906, __pyx_L1_error))
15264 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15266 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15268 __Pyx_PyGILState_Release(__pyx_gilstate_save);
15273 __Pyx_TraceReturn(Py_None, 1);
15285 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view,
char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
15286 Py_ssize_t __pyx_v_shape;
15287 Py_ssize_t __pyx_v_stride;
15288 Py_ssize_t __pyx_v_suboffset;
15289 Py_ssize_t __pyx_v_itemsize;
15290 char *__pyx_v_resultp;
15292 __Pyx_TraceDeclarations
15293 __Pyx_RefNannyDeclarations
15294 Py_ssize_t __pyx_t_1;
15296 PyObject *__pyx_t_3 = NULL;
15297 PyObject *__pyx_t_4 = NULL;
15298 int __pyx_lineno = 0;
15299 const char *__pyx_filename = NULL;
15300 int __pyx_clineno = 0;
15301 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
15302 __Pyx_TraceCall(
"pybuffer_index", __pyx_f[2], 912, 0, __PYX_ERR(2, 912, __pyx_L1_error));
15311 __Pyx_TraceLine(914,0,__PYX_ERR(2, 914, __pyx_L1_error))
15312 __pyx_v_suboffset = -1L;
15321 __Pyx_TraceLine(915,0,__PYX_ERR(2, 915, __pyx_L1_error))
15322 __pyx_t_1 = __pyx_v_view->itemsize;
15323 __pyx_v_itemsize = __pyx_t_1;
15332 __Pyx_TraceLine(918,0,__PYX_ERR(2, 918, __pyx_L1_error))
15333 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
15343 __Pyx_TraceLine(919,0,__PYX_ERR(2, 919, __pyx_L1_error))
15344 if (unlikely(__pyx_v_itemsize == 0)) {
15345 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
15346 __PYX_ERR(2, 919, __pyx_L1_error)
15348 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
15349 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
15350 __PYX_ERR(2, 919, __pyx_L1_error)
15352 __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
15361 __Pyx_TraceLine(920,0,__PYX_ERR(2, 920, __pyx_L1_error))
15362 __pyx_v_stride = __pyx_v_itemsize;
15381 __Pyx_TraceLine(922,0,__PYX_ERR(2, 922, __pyx_L1_error))
15383 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
15392 __Pyx_TraceLine(923,0,__PYX_ERR(2, 923, __pyx_L1_error))
15393 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
15402 __Pyx_TraceLine(924,0,__PYX_ERR(2, 924, __pyx_L1_error))
15403 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
15413 __Pyx_TraceLine(925,0,__PYX_ERR(2, 925, __pyx_L1_error))
15414 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
15434 __Pyx_TraceLine(927,0,__PYX_ERR(2, 927, __pyx_L1_error))
15435 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15445 __Pyx_TraceLine(928,0,__PYX_ERR(2, 928, __pyx_L1_error))
15446 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
15455 __Pyx_TraceLine(929,0,__PYX_ERR(2, 929, __pyx_L1_error))
15456 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15457 if (unlikely(__pyx_t_2)) {
15466 __Pyx_TraceLine(930,0,__PYX_ERR(2, 930, __pyx_L1_error))
15467 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error)
15468 __Pyx_GOTREF(__pyx_t_3);
15469 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error)
15470 __Pyx_GOTREF(__pyx_t_4);
15471 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15472 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error)
15473 __Pyx_GOTREF(__pyx_t_3);
15474 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15475 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15476 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15477 __PYX_ERR(2, 930, __pyx_L1_error)
15504 __Pyx_TraceLine(932,0,__PYX_ERR(2, 932, __pyx_L1_error))
15505 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
15506 if (unlikely(__pyx_t_2)) {
15515 __Pyx_TraceLine(933,0,__PYX_ERR(2, 933, __pyx_L1_error))
15516 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error)
15517 __Pyx_GOTREF(__pyx_t_3);
15518 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error)
15519 __Pyx_GOTREF(__pyx_t_4);
15520 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15521 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error)
15522 __Pyx_GOTREF(__pyx_t_3);
15523 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15524 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15525 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15526 __PYX_ERR(2, 933, __pyx_L1_error)
15544 __Pyx_TraceLine(935,0,__PYX_ERR(2, 935, __pyx_L1_error))
15545 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
15554 __Pyx_TraceLine(936,0,__PYX_ERR(2, 936, __pyx_L1_error))
15555 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15565 __Pyx_TraceLine(937,0,__PYX_ERR(2, 937, __pyx_L1_error))
15566 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
15584 __Pyx_TraceLine(939,0,__PYX_ERR(2, 939, __pyx_L1_error))
15585 __pyx_r = __pyx_v_resultp;
15598 __Pyx_XDECREF(__pyx_t_3);
15599 __Pyx_XDECREF(__pyx_t_4);
15600 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
15603 __Pyx_TraceReturn(Py_None, 0);
15604 __Pyx_RefNannyFinishContext();
15616 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
15618 Py_ssize_t *__pyx_v_shape;
15619 Py_ssize_t *__pyx_v_strides;
15623 __Pyx_TraceDeclarations
15625 Py_ssize_t *__pyx_t_2;
15628 Py_ssize_t __pyx_t_5;
15629 Py_ssize_t __pyx_t_6;
15633 int __pyx_lineno = 0;
15634 const char *__pyx_filename = NULL;
15635 int __pyx_clineno = 0;
15636 __Pyx_TraceCall(
"transpose_memslice", __pyx_f[2], 945, 1, __PYX_ERR(2, 945, __pyx_L1_error));
15645 __Pyx_TraceLine(946,1,__PYX_ERR(2, 946, __pyx_L1_error))
15646 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
15647 __pyx_v_ndim = __pyx_t_1;
15656 __Pyx_TraceLine(948,1,__PYX_ERR(2, 948, __pyx_L1_error))
15657 __pyx_t_2 = __pyx_v_memslice->shape;
15658 __pyx_v_shape = __pyx_t_2;
15667 __Pyx_TraceLine(949,1,__PYX_ERR(2, 949, __pyx_L1_error))
15668 __pyx_t_2 = __pyx_v_memslice->strides;
15669 __pyx_v_strides = __pyx_t_2;
15678 __Pyx_TraceLine(953,1,__PYX_ERR(2, 953, __pyx_L1_error))
15679 __pyx_t_3 = (__pyx_v_ndim / 2);
15680 __pyx_t_4 = __pyx_t_3;
15681 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
15682 __pyx_v_i = __pyx_t_1;
15691 __Pyx_TraceLine(954,1,__PYX_ERR(2, 954, __pyx_L1_error))
15692 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
15701 __Pyx_TraceLine(955,1,__PYX_ERR(2, 955, __pyx_L1_error))
15702 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
15703 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
15704 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
15705 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
15714 __Pyx_TraceLine(956,1,__PYX_ERR(2, 956, __pyx_L1_error))
15715 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
15716 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
15717 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
15718 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
15727 __Pyx_TraceLine(958,1,__PYX_ERR(2, 958, __pyx_L1_error))
15728 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
15731 __pyx_t_7 = __pyx_t_8;
15732 goto __pyx_L6_bool_binop_done;
15734 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
15735 __pyx_t_7 = __pyx_t_8;
15736 __pyx_L6_bool_binop_done:;
15746 __Pyx_TraceLine(959,1,__PYX_ERR(2, 959, __pyx_L1_error))
15747 __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((
char *)
"Cannot transpose memoryview with indirect dimensions"));
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 959, __pyx_L1_error)
15766 __Pyx_TraceLine(961,1,__PYX_ERR(2, 961, __pyx_L1_error))
15782 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15784 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15786 __Pyx_PyGILState_Release(__pyx_gilstate_save);
15791 __Pyx_TraceReturn(Py_None, 1);
15804 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
15805 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
15806 __Pyx_RefNannyDeclarations
15807 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
15808 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
15811 __Pyx_RefNannyFinishContext();
15814 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
15815 __Pyx_TraceDeclarations
15816 __Pyx_RefNannyDeclarations
15817 int __pyx_lineno = 0;
15818 const char *__pyx_filename = NULL;
15819 int __pyx_clineno = 0;
15820 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
15821 __Pyx_TraceCall(
"__dealloc__", __pyx_f[2], 978, 0, __PYX_ERR(2, 978, __pyx_L1_error));
15830 __Pyx_TraceLine(979,0,__PYX_ERR(2, 979, __pyx_L1_error))
15831 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
15844 __Pyx_WriteUnraisable(
"View.MemoryView._memoryviewslice.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
15846 __Pyx_TraceReturn(Py_None, 0);
15847 __Pyx_RefNannyFinishContext();
15858 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
15859 PyObject *__pyx_r = NULL;
15860 __Pyx_TraceDeclarations
15861 __Pyx_RefNannyDeclarations
15863 PyObject *__pyx_t_2 = NULL;
15864 int __pyx_lineno = 0;
15865 const char *__pyx_filename = NULL;
15866 int __pyx_clineno = 0;
15867 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
15868 __Pyx_TraceCall(
"convert_item_to_object", __pyx_f[2], 981, 0, __PYX_ERR(2, 981, __pyx_L1_error));
15877 __Pyx_TraceLine(982,0,__PYX_ERR(2, 982, __pyx_L1_error))
15878 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
15888 __Pyx_TraceLine(983,0,__PYX_ERR(2, 983, __pyx_L1_error))
15889 __Pyx_XDECREF(__pyx_r);
15890 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
15891 __Pyx_GOTREF(__pyx_t_2);
15892 __pyx_r = __pyx_t_2;
15912 __Pyx_TraceLine(985,0,__PYX_ERR(2, 985, __pyx_L1_error))
15914 __Pyx_XDECREF(__pyx_r);
15915 __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error)
15916 __Pyx_GOTREF(__pyx_t_2);
15917 __pyx_r = __pyx_t_2;
15932 __Pyx_XDECREF(__pyx_t_2);
15933 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
15936 __Pyx_XGIVEREF(__pyx_r);
15937 __Pyx_TraceReturn(__pyx_r, 0);
15938 __Pyx_RefNannyFinishContext();
15950 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
15951 PyObject *__pyx_r = NULL;
15952 __Pyx_TraceDeclarations
15953 __Pyx_RefNannyDeclarations
15956 PyObject *__pyx_t_3 = NULL;
15957 int __pyx_lineno = 0;
15958 const char *__pyx_filename = NULL;
15959 int __pyx_clineno = 0;
15960 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
15961 __Pyx_TraceCall(
"assign_item_from_object", __pyx_f[2], 987, 0, __PYX_ERR(2, 987, __pyx_L1_error));
15970 __Pyx_TraceLine(988,0,__PYX_ERR(2, 988, __pyx_L1_error))
15971 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
15981 __Pyx_TraceLine(989,0,__PYX_ERR(2, 989, __pyx_L1_error))
15982 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value);
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(2, 989, __pyx_L1_error)
16001 __Pyx_TraceLine(991,0,__PYX_ERR(2, 991, __pyx_L1_error))
16003 __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error)
16004 __Pyx_GOTREF(__pyx_t_3);
16005 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16018 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16021 __Pyx_XDECREF(__pyx_t_3);
16022 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16025 __Pyx_XGIVEREF(__pyx_r);
16026 __Pyx_TraceReturn(__pyx_r, 0);
16027 __Pyx_RefNannyFinishContext();
16040 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
16041 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
16042 PyObject *__pyx_r = 0;
16043 __Pyx_RefNannyDeclarations
16044 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
16045 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16048 __Pyx_RefNannyFinishContext();
16052 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16053 PyObject *__pyx_r = NULL;
16054 __Pyx_TraceDeclarations
16055 __Pyx_RefNannyDeclarations
16056 int __pyx_lineno = 0;
16057 const char *__pyx_filename = NULL;
16058 int __pyx_clineno = 0;
16059 __Pyx_RefNannySetupContext(
"__get__", 0);
16060 __Pyx_TraceCall(
"__get__", __pyx_f[2], 994, 0, __PYX_ERR(2, 994, __pyx_L1_error));
16069 __Pyx_TraceLine(995,0,__PYX_ERR(2, 995, __pyx_L1_error))
16070 __Pyx_XDECREF(__pyx_r);
16071 __Pyx_INCREF(__pyx_v_self->from_object);
16072 __pyx_r = __pyx_v_self->from_object;
16085 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16088 __Pyx_XGIVEREF(__pyx_r);
16089 __Pyx_TraceReturn(__pyx_r, 0);
16090 __Pyx_RefNannyFinishContext();
16101 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
16102 static PyMethodDef __pyx_mdef___pyx_memoryviewslice_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0};
16103 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16104 PyObject *__pyx_r = 0;
16105 __Pyx_RefNannyDeclarations
16106 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
16107 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16110 __Pyx_RefNannyFinishContext();
16114 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16115 PyObject *__pyx_r = NULL;
16116 __Pyx_TraceDeclarations
16117 __Pyx_RefNannyDeclarations
16118 PyObject *__pyx_t_1 = NULL;
16119 int __pyx_lineno = 0;
16120 const char *__pyx_filename = NULL;
16121 int __pyx_clineno = 0;
16122 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
16123 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
16131 __Pyx_TraceLine(2,0,__PYX_ERR(2, 2, __pyx_L1_error))
16132 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
16133 __Pyx_GOTREF(__pyx_t_1);
16134 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16135 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16136 __PYX_ERR(2, 2, __pyx_L1_error)
16146 __Pyx_XDECREF(__pyx_t_1);
16147 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16149 __Pyx_XGIVEREF(__pyx_r);
16150 __Pyx_TraceReturn(__pyx_r, 0);
16151 __Pyx_RefNannyFinishContext();
16163 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
16164 static PyMethodDef __pyx_mdef___pyx_memoryviewslice_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0};
16165 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16166 PyObject *__pyx_r = 0;
16167 __Pyx_RefNannyDeclarations
16168 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
16169 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16172 __Pyx_RefNannyFinishContext();
16176 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
16177 PyObject *__pyx_r = NULL;
16178 __Pyx_TraceDeclarations
16179 __Pyx_RefNannyDeclarations
16180 PyObject *__pyx_t_1 = NULL;
16181 int __pyx_lineno = 0;
16182 const char *__pyx_filename = NULL;
16183 int __pyx_clineno = 0;
16184 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
16185 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[2], 3, 0, __PYX_ERR(2, 3, __pyx_L1_error));
16192 __Pyx_TraceLine(4,0,__PYX_ERR(2, 4, __pyx_L1_error))
16193 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
16194 __Pyx_GOTREF(__pyx_t_1);
16195 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16196 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16197 __PYX_ERR(2, 4, __pyx_L1_error)
16208 __Pyx_XDECREF(__pyx_t_1);
16209 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16211 __Pyx_XGIVEREF(__pyx_r);
16212 __Pyx_TraceReturn(__pyx_r, 0);
16213 __Pyx_RefNannyFinishContext();
16225 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,
int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(
char *),
int (*__pyx_v_to_dtype_func)(
char *, PyObject *),
int __pyx_v_dtype_is_object) {
16226 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
16227 Py_ssize_t __pyx_v_suboffset;
16228 PyObject *__pyx_v_length = NULL;
16229 PyObject *__pyx_r = NULL;
16230 __Pyx_TraceDeclarations
16231 __Pyx_RefNannyDeclarations
16233 PyObject *__pyx_t_2 = NULL;
16234 PyObject *__pyx_t_3 = NULL;
16235 __Pyx_TypeInfo *__pyx_t_4;
16236 Py_buffer __pyx_t_5;
16237 Py_ssize_t *__pyx_t_6;
16238 Py_ssize_t *__pyx_t_7;
16239 Py_ssize_t *__pyx_t_8;
16240 Py_ssize_t __pyx_t_9;
16241 int __pyx_lineno = 0;
16242 const char *__pyx_filename = NULL;
16243 int __pyx_clineno = 0;
16244 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
16245 __Pyx_TraceCall(
"memoryview_fromslice", __pyx_f[2], 1001, 0, __PYX_ERR(2, 1001, __pyx_L1_error));
16254 __Pyx_TraceLine(1009,0,__PYX_ERR(2, 1009, __pyx_L1_error))
16255 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
16265 __Pyx_TraceLine(1010,0,__PYX_ERR(2, 1010, __pyx_L1_error))
16266 __Pyx_XDECREF(__pyx_r);
16267 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16286 __Pyx_TraceLine(1015,0,__PYX_ERR(2, 1015, __pyx_L1_error))
16287 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error)
16288 __Pyx_GOTREF(__pyx_t_2);
16289 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error)
16290 __Pyx_GOTREF(__pyx_t_3);
16291 __Pyx_INCREF(Py_None);
16292 __Pyx_GIVEREF(Py_None);
16293 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
16294 __Pyx_INCREF(__pyx_int_0);
16295 __Pyx_GIVEREF(__pyx_int_0);
16296 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
16297 __Pyx_GIVEREF(__pyx_t_2);
16298 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
16300 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error)
16301 __Pyx_GOTREF(__pyx_t_2);
16302 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16303 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
16313 __Pyx_TraceLine(1017,0,__PYX_ERR(2, 1017, __pyx_L1_error))
16314 __pyx_v_result->from_slice = __pyx_v_memviewslice;
16323 __Pyx_TraceLine(1018,0,__PYX_ERR(2, 1018, __pyx_L1_error))
16324 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
16333 __Pyx_TraceLine(1020,0,__PYX_ERR(2, 1020, __pyx_L1_error))
16334 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error)
16335 __Pyx_GOTREF(__pyx_t_2);
16336 __Pyx_GIVEREF(__pyx_t_2);
16337 __Pyx_GOTREF(__pyx_v_result->from_object);
16338 __Pyx_DECREF(__pyx_v_result->from_object);
16339 __pyx_v_result->from_object = __pyx_t_2;
16349 __Pyx_TraceLine(1021,0,__PYX_ERR(2, 1021, __pyx_L1_error))
16350 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
16351 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
16360 __Pyx_TraceLine(1023,0,__PYX_ERR(2, 1023, __pyx_L1_error))
16361 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
16362 __pyx_v_result->__pyx_base.view = __pyx_t_5;
16371 __Pyx_TraceLine(1024,0,__PYX_ERR(2, 1024, __pyx_L1_error))
16372 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
16381 __Pyx_TraceLine(1025,0,__PYX_ERR(2, 1025, __pyx_L1_error))
16382 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
16391 __Pyx_TraceLine(1026,0,__PYX_ERR(2, 1026, __pyx_L1_error))
16392 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
16401 __Pyx_TraceLine(1027,0,__PYX_ERR(2, 1027, __pyx_L1_error))
16402 Py_INCREF(Py_None);
16411 __Pyx_TraceLine(1029,0,__PYX_ERR(2, 1029, __pyx_L1_error))
16412 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
16422 __Pyx_TraceLine(1030,0,__PYX_ERR(2, 1030, __pyx_L1_error))
16423 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
16442 __Pyx_TraceLine(1032,0,__PYX_ERR(2, 1032, __pyx_L1_error))
16444 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
16455 __Pyx_TraceLine(1034,0,__PYX_ERR(2, 1034, __pyx_L1_error))
16456 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
16465 __Pyx_TraceLine(1035,0,__PYX_ERR(2, 1035, __pyx_L1_error))
16466 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
16475 __Pyx_TraceLine(1038,0,__PYX_ERR(2, 1038, __pyx_L1_error))
16476 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
16485 __Pyx_TraceLine(1039,0,__PYX_ERR(2, 1039, __pyx_L1_error))
16486 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
16487 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16488 __pyx_t_6 = __pyx_t_8;
16489 __pyx_v_suboffset = (__pyx_t_6[0]);
16498 __Pyx_TraceLine(1040,0,__PYX_ERR(2, 1040, __pyx_L1_error))
16499 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
16509 __Pyx_TraceLine(1041,0,__PYX_ERR(2, 1041, __pyx_L1_error))
16510 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
16519 __Pyx_TraceLine(1042,0,__PYX_ERR(2, 1042, __pyx_L1_error))
16520 goto __pyx_L6_break;
16540 __Pyx_TraceLine(1044,0,__PYX_ERR(2, 1044, __pyx_L1_error))
16541 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
16542 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16551 __Pyx_TraceLine(1045,0,__PYX_ERR(2, 1045, __pyx_L1_error))
16552 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
16553 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16554 __pyx_t_6 = __pyx_t_8;
16555 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error)
16556 __Pyx_GOTREF(__pyx_t_2);
16557 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
16567 __Pyx_TraceLine(1046,0,__PYX_ERR(2, 1046, __pyx_L1_error))
16568 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error)
16569 __Pyx_GOTREF(__pyx_t_2);
16570 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error)
16571 __Pyx_GOTREF(__pyx_t_3);
16572 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16573 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error)
16574 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16575 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16585 __Pyx_TraceLine(1048,0,__PYX_ERR(2, 1048, __pyx_L1_error))
16586 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
16595 __Pyx_TraceLine(1049,0,__PYX_ERR(2, 1049, __pyx_L1_error))
16596 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
16605 __Pyx_TraceLine(1051,0,__PYX_ERR(2, 1051, __pyx_L1_error))
16606 __Pyx_XDECREF(__pyx_r);
16607 __Pyx_INCREF(((PyObject *)__pyx_v_result));
16608 __pyx_r = ((PyObject *)__pyx_v_result);
16621 __Pyx_XDECREF(__pyx_t_2);
16622 __Pyx_XDECREF(__pyx_t_3);
16623 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16626 __Pyx_XDECREF((PyObject *)__pyx_v_result);
16627 __Pyx_XDECREF(__pyx_v_length);
16628 __Pyx_XGIVEREF(__pyx_r);
16629 __Pyx_TraceReturn(__pyx_r, 0);
16630 __Pyx_RefNannyFinishContext();
16642 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
16643 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
16644 __Pyx_memviewslice *__pyx_r;
16645 __Pyx_TraceDeclarations
16646 __Pyx_RefNannyDeclarations
16649 PyObject *__pyx_t_3 = NULL;
16650 int __pyx_lineno = 0;
16651 const char *__pyx_filename = NULL;
16652 int __pyx_clineno = 0;
16653 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
16654 __Pyx_TraceCall(
"get_slice_from_memview", __pyx_f[2], 1054, 0, __PYX_ERR(2, 1054, __pyx_L1_error));
16663 __Pyx_TraceLine(1057,0,__PYX_ERR(2, 1057, __pyx_L1_error))
16664 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16665 __pyx_t_2 = (__pyx_t_1 != 0);
16675 __Pyx_TraceLine(1058,0,__PYX_ERR(2, 1058, __pyx_L1_error))
16676 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error)
16677 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
16678 __Pyx_INCREF(__pyx_t_3);
16679 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
16689 __Pyx_TraceLine(1059,0,__PYX_ERR(2, 1059, __pyx_L1_error))
16690 __pyx_r = (&__pyx_v_obj->from_slice);
16709 __Pyx_TraceLine(1061,0,__PYX_ERR(2, 1061, __pyx_L1_error))
16711 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
16720 __Pyx_TraceLine(1062,0,__PYX_ERR(2, 1062, __pyx_L1_error))
16721 __pyx_r = __pyx_v_mslice;
16735 __Pyx_XDECREF(__pyx_t_3);
16736 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
16739 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
16740 __Pyx_TraceReturn(Py_None, 0);
16741 __Pyx_RefNannyFinishContext();
16753 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
16755 Py_ssize_t *__pyx_v_shape;
16756 Py_ssize_t *__pyx_v_strides;
16757 Py_ssize_t *__pyx_v_suboffsets;
16758 __Pyx_TraceDeclarations
16759 __Pyx_RefNannyDeclarations
16760 Py_ssize_t *__pyx_t_1;
16764 Py_ssize_t __pyx_t_5;
16765 int __pyx_lineno = 0;
16766 const char *__pyx_filename = NULL;
16767 int __pyx_clineno = 0;
16768 __Pyx_RefNannySetupContext(
"slice_copy", 0);
16769 __Pyx_TraceCall(
"slice_copy", __pyx_f[2], 1065, 0, __PYX_ERR(2, 1065, __pyx_L1_error));
16778 __Pyx_TraceLine(1069,0,__PYX_ERR(2, 1069, __pyx_L1_error))
16779 __pyx_t_1 = __pyx_v_memview->view.shape;
16780 __pyx_v_shape = __pyx_t_1;
16789 __Pyx_TraceLine(1070,0,__PYX_ERR(2, 1070, __pyx_L1_error))
16790 __pyx_t_1 = __pyx_v_memview->view.strides;
16791 __pyx_v_strides = __pyx_t_1;
16800 __Pyx_TraceLine(1071,0,__PYX_ERR(2, 1071, __pyx_L1_error))
16801 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
16802 __pyx_v_suboffsets = __pyx_t_1;
16811 __Pyx_TraceLine(1073,0,__PYX_ERR(2, 1073, __pyx_L1_error))
16812 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
16821 __Pyx_TraceLine(1074,0,__PYX_ERR(2, 1074, __pyx_L1_error))
16822 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
16831 __Pyx_TraceLine(1076,0,__PYX_ERR(2, 1076, __pyx_L1_error))
16832 __pyx_t_2 = __pyx_v_memview->view.ndim;
16833 __pyx_t_3 = __pyx_t_2;
16834 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16835 __pyx_v_dim = __pyx_t_4;
16844 __Pyx_TraceLine(1077,0,__PYX_ERR(2, 1077, __pyx_L1_error))
16845 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
16854 __Pyx_TraceLine(1078,0,__PYX_ERR(2, 1078, __pyx_L1_error))
16855 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
16864 __Pyx_TraceLine(1079,0,__PYX_ERR(2, 1079, __pyx_L1_error))
16865 if ((__pyx_v_suboffsets != 0)) {
16866 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
16870 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
16884 __Pyx_WriteUnraisable(
"View.MemoryView.slice_copy", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
16886 __Pyx_TraceReturn(Py_None, 0);
16887 __Pyx_RefNannyFinishContext();
16898 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
16899 __Pyx_memviewslice __pyx_v_memviewslice;
16900 PyObject *__pyx_r = NULL;
16901 __Pyx_TraceDeclarations
16902 __Pyx_RefNannyDeclarations
16903 PyObject *__pyx_t_1 = NULL;
16904 int __pyx_lineno = 0;
16905 const char *__pyx_filename = NULL;
16906 int __pyx_clineno = 0;
16907 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
16908 __Pyx_TraceCall(
"memoryview_copy", __pyx_f[2], 1082, 0, __PYX_ERR(2, 1082, __pyx_L1_error));
16917 __Pyx_TraceLine(1085,0,__PYX_ERR(2, 1085, __pyx_L1_error))
16918 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
16927 __Pyx_TraceLine(1086,0,__PYX_ERR(2, 1086, __pyx_L1_error))
16928 __Pyx_XDECREF(__pyx_r);
16929 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error)
16930 __Pyx_GOTREF(__pyx_t_1);
16931 __pyx_r = __pyx_t_1;
16945 __Pyx_XDECREF(__pyx_t_1);
16946 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
16949 __Pyx_XGIVEREF(__pyx_r);
16950 __Pyx_TraceReturn(__pyx_r, 0);
16951 __Pyx_RefNannyFinishContext();
16963 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
16964 PyObject *(*__pyx_v_to_object_func)(
char *);
16965 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
16966 PyObject *__pyx_r = NULL;
16967 __Pyx_TraceDeclarations
16968 __Pyx_RefNannyDeclarations
16971 PyObject *(*__pyx_t_3)(
char *);
16972 int (*__pyx_t_4)(
char *, PyObject *);
16973 PyObject *__pyx_t_5 = NULL;
16974 int __pyx_lineno = 0;
16975 const char *__pyx_filename = NULL;
16976 int __pyx_clineno = 0;
16977 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
16978 __Pyx_TraceCall(
"memoryview_copy_from_slice", __pyx_f[2], 1089, 0, __PYX_ERR(2, 1089, __pyx_L1_error));
16987 __Pyx_TraceLine(1096,0,__PYX_ERR(2, 1096, __pyx_L1_error))
16988 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16989 __pyx_t_2 = (__pyx_t_1 != 0);
16999 __Pyx_TraceLine(1097,0,__PYX_ERR(2, 1097, __pyx_L1_error))
17000 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
17001 __pyx_v_to_object_func = __pyx_t_3;
17010 __Pyx_TraceLine(1098,0,__PYX_ERR(2, 1098, __pyx_L1_error))
17011 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
17012 __pyx_v_to_dtype_func = __pyx_t_4;
17031 __Pyx_TraceLine(1100,0,__PYX_ERR(2, 1100, __pyx_L1_error))
17033 __pyx_v_to_object_func = NULL;
17042 __Pyx_TraceLine(1101,0,__PYX_ERR(2, 1101, __pyx_L1_error))
17043 __pyx_v_to_dtype_func = NULL;
17054 __Pyx_TraceLine(1103,0,__PYX_ERR(2, 1103, __pyx_L1_error))
17055 __Pyx_XDECREF(__pyx_r);
17064 __Pyx_TraceLine(1105,0,__PYX_ERR(2, 1105, __pyx_L1_error))
17065 __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error)
17066 __Pyx_GOTREF(__pyx_t_5);
17067 __pyx_r = __pyx_t_5;
17081 __Pyx_XDECREF(__pyx_t_5);
17082 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17085 __Pyx_XGIVEREF(__pyx_r);
17086 __Pyx_TraceReturn(__pyx_r, 0);
17087 __Pyx_RefNannyFinishContext();
17099 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
17100 Py_ssize_t __pyx_r;
17101 __Pyx_TraceDeclarations
17103 int __pyx_lineno = 0;
17104 const char *__pyx_filename = NULL;
17105 int __pyx_clineno = 0;
17106 __Pyx_TraceCall(
"abs_py_ssize_t", __pyx_f[2], 1111, 1, __PYX_ERR(2, 1111, __pyx_L1_error));
17115 __Pyx_TraceLine(1112,1,__PYX_ERR(2, 1112, __pyx_L1_error))
17116 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
17126 __Pyx_TraceLine(1113,1,__PYX_ERR(2, 1113, __pyx_L1_error))
17127 __pyx_r = (-__pyx_v_arg);
17146 __Pyx_TraceLine(1115,1,__PYX_ERR(2, 1115, __pyx_L1_error))
17148 __pyx_r = __pyx_v_arg;
17162 __Pyx_WriteUnraisable(
"View.MemoryView.abs_py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17165 __Pyx_TraceReturn(Py_None, 1);
17177 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
17179 Py_ssize_t __pyx_v_c_stride;
17180 Py_ssize_t __pyx_v_f_stride;
17182 __Pyx_TraceDeclarations
17187 int __pyx_lineno = 0;
17188 const char *__pyx_filename = NULL;
17189 int __pyx_clineno = 0;
17190 __Pyx_TraceCall(
"get_best_order", __pyx_f[2], 1118, 1, __PYX_ERR(2, 1118, __pyx_L1_error));
17199 __Pyx_TraceLine(1123,1,__PYX_ERR(2, 1123, __pyx_L1_error))
17200 __pyx_v_c_stride = 0;
17209 __Pyx_TraceLine(1124,1,__PYX_ERR(2, 1124, __pyx_L1_error))
17210 __pyx_v_f_stride = 0;
17219 __Pyx_TraceLine(1126,1,__PYX_ERR(2, 1126, __pyx_L1_error))
17220 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17221 __pyx_v_i = __pyx_t_1;
17230 __Pyx_TraceLine(1127,1,__PYX_ERR(2, 1127, __pyx_L1_error))
17231 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17241 __Pyx_TraceLine(1128,1,__PYX_ERR(2, 1128, __pyx_L1_error))
17242 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17251 __Pyx_TraceLine(1129,1,__PYX_ERR(2, 1129, __pyx_L1_error))
17252 goto __pyx_L4_break;
17272 __Pyx_TraceLine(1131,1,__PYX_ERR(2, 1131, __pyx_L1_error))
17273 __pyx_t_1 = __pyx_v_ndim;
17274 __pyx_t_3 = __pyx_t_1;
17275 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17276 __pyx_v_i = __pyx_t_4;
17285 __Pyx_TraceLine(1132,1,__PYX_ERR(2, 1132, __pyx_L1_error))
17286 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17296 __Pyx_TraceLine(1133,1,__PYX_ERR(2, 1133, __pyx_L1_error))
17297 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17306 __Pyx_TraceLine(1134,1,__PYX_ERR(2, 1134, __pyx_L1_error))
17307 goto __pyx_L7_break;
17327 __Pyx_TraceLine(1136,1,__PYX_ERR(2, 1136, __pyx_L1_error))
17328 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
17338 __Pyx_TraceLine(1137,1,__PYX_ERR(2, 1137, __pyx_L1_error))
17358 __Pyx_TraceLine(1139,1,__PYX_ERR(2, 1139, __pyx_L1_error))
17374 __Pyx_WriteUnraisable(
"View.MemoryView.get_best_order", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17377 __Pyx_TraceReturn(Py_None, 1);
17389 static void _copy_strided_to_strided(
char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides,
char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
17390 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17391 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
17392 Py_ssize_t __pyx_v_dst_extent;
17393 Py_ssize_t __pyx_v_src_stride;
17394 Py_ssize_t __pyx_v_dst_stride;
17398 Py_ssize_t __pyx_t_4;
17399 Py_ssize_t __pyx_t_5;
17400 Py_ssize_t __pyx_t_6;
17409 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
17418 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
17427 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
17436 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
17445 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17455 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
17458 __pyx_t_1 = __pyx_t_2;
17459 goto __pyx_L5_bool_binop_done;
17461 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
17464 __pyx_t_1 = __pyx_t_2;
17465 goto __pyx_L5_bool_binop_done;
17475 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
17477 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
17479 __pyx_t_3 = (__pyx_t_2 != 0);
17480 __pyx_t_1 = __pyx_t_3;
17481 __pyx_L5_bool_binop_done:;
17499 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
17519 __pyx_t_4 = __pyx_v_dst_extent;
17520 __pyx_t_5 = __pyx_t_4;
17521 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17522 __pyx_v_i = __pyx_t_6;
17531 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
17540 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17549 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17572 __pyx_t_4 = __pyx_v_dst_extent;
17573 __pyx_t_5 = __pyx_t_4;
17574 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17575 __pyx_v_i = __pyx_t_6;
17584 _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
17593 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17602 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17626 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
17627 __Pyx_TraceDeclarations
17628 int __pyx_lineno = 0;
17629 const char *__pyx_filename = NULL;
17630 int __pyx_clineno = 0;
17631 __Pyx_TraceCall(
"copy_strided_to_strided", __pyx_f[2], 1172, 1, __PYX_ERR(2, 1172, __pyx_L1_error));
17640 __Pyx_TraceLine(1175,1,__PYX_ERR(2, 1175, __pyx_L1_error))
17641 _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
17654 __Pyx_WriteUnraisable(
"View.MemoryView.copy_strided_to_strided", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17656 __Pyx_TraceReturn(Py_None, 1);
17667 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
17668 Py_ssize_t __pyx_v_shape;
17669 Py_ssize_t __pyx_v_size;
17670 Py_ssize_t __pyx_r;
17671 __Pyx_TraceDeclarations
17672 Py_ssize_t __pyx_t_1;
17673 Py_ssize_t *__pyx_t_2;
17674 Py_ssize_t *__pyx_t_3;
17675 Py_ssize_t *__pyx_t_4;
17676 int __pyx_lineno = 0;
17677 const char *__pyx_filename = NULL;
17678 int __pyx_clineno = 0;
17679 __Pyx_TraceCall(
"slice_get_size", __pyx_f[2], 1179, 1, __PYX_ERR(2, 1179, __pyx_L1_error));
17688 __Pyx_TraceLine(1181,1,__PYX_ERR(2, 1181, __pyx_L1_error))
17689 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17690 __pyx_v_size = __pyx_t_1;
17699 __Pyx_TraceLine(1183,1,__PYX_ERR(2, 1183, __pyx_L1_error))
17700 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
17701 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
17702 __pyx_t_2 = __pyx_t_4;
17703 __pyx_v_shape = (__pyx_t_2[0]);
17712 __Pyx_TraceLine(1184,1,__PYX_ERR(2, 1184, __pyx_L1_error))
17713 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
17723 __Pyx_TraceLine(1186,1,__PYX_ERR(2, 1186, __pyx_L1_error))
17724 __pyx_r = __pyx_v_size;
17737 __Pyx_WriteUnraisable(
"View.MemoryView.slice_get_size", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17740 __Pyx_TraceReturn(Py_None, 1);
17752 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride,
int __pyx_v_ndim,
char __pyx_v_order) {
17754 Py_ssize_t __pyx_r;
17755 __Pyx_TraceDeclarations
17760 int __pyx_lineno = 0;
17761 const char *__pyx_filename = NULL;
17762 int __pyx_clineno = 0;
17763 __Pyx_TraceCall(
"fill_contig_strides_array", __pyx_f[2], 1189, 1, __PYX_ERR(2, 1189, __pyx_L1_error));
17772 __Pyx_TraceLine(1198,1,__PYX_ERR(2, 1198, __pyx_L1_error))
17773 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
17783 __Pyx_TraceLine(1199,1,__PYX_ERR(2, 1199, __pyx_L1_error))
17784 __pyx_t_2 = __pyx_v_ndim;
17785 __pyx_t_3 = __pyx_t_2;
17786 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17787 __pyx_v_idx = __pyx_t_4;
17796 __Pyx_TraceLine(1200,1,__PYX_ERR(2, 1200, __pyx_L1_error))
17797 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17806 __Pyx_TraceLine(1201,1,__PYX_ERR(2, 1201, __pyx_L1_error))
17807 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17827 __Pyx_TraceLine(1203,1,__PYX_ERR(2, 1203, __pyx_L1_error))
17829 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
17830 __pyx_v_idx = __pyx_t_2;
17839 __Pyx_TraceLine(1204,1,__PYX_ERR(2, 1204, __pyx_L1_error))
17840 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17849 __Pyx_TraceLine(1205,1,__PYX_ERR(2, 1205, __pyx_L1_error))
17850 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17862 __Pyx_TraceLine(1207,1,__PYX_ERR(2, 1207, __pyx_L1_error))
17863 __pyx_r = __pyx_v_stride;
17876 __Pyx_WriteUnraisable(
"View.MemoryView.fill_contig_strides_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17879 __Pyx_TraceReturn(Py_None, 1);
17891 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice,
char __pyx_v_order,
int __pyx_v_ndim) {
17893 void *__pyx_v_result;
17894 size_t __pyx_v_itemsize;
17895 size_t __pyx_v_size;
17897 __Pyx_TraceDeclarations
17898 Py_ssize_t __pyx_t_1;
17901 struct __pyx_memoryview_obj *__pyx_t_4;
17904 int __pyx_lineno = 0;
17905 const char *__pyx_filename = NULL;
17906 int __pyx_clineno = 0;
17907 __Pyx_TraceCall(
"copy_data_to_temp", __pyx_f[2], 1210, 1, __PYX_ERR(2, 1210, __pyx_L1_error));
17916 __Pyx_TraceLine(1221,1,__PYX_ERR(2, 1221, __pyx_L1_error))
17917 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17918 __pyx_v_itemsize = __pyx_t_1;
17927 __Pyx_TraceLine(1222,1,__PYX_ERR(2, 1222, __pyx_L1_error))
17928 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
17937 __Pyx_TraceLine(1224,1,__PYX_ERR(2, 1224, __pyx_L1_error))
17938 __pyx_v_result = malloc(__pyx_v_size);
17947 __Pyx_TraceLine(1225,1,__PYX_ERR(2, 1225, __pyx_L1_error))
17948 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
17958 __Pyx_TraceLine(1226,1,__PYX_ERR(2, 1226, __pyx_L1_error))
17959 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error)
17977 __Pyx_TraceLine(1229,1,__PYX_ERR(2, 1229, __pyx_L1_error))
17978 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
17987 __Pyx_TraceLine(1230,1,__PYX_ERR(2, 1230, __pyx_L1_error))
17988 __pyx_t_4 = __pyx_v_src->memview;
17989 __pyx_v_tmpslice->memview = __pyx_t_4;
17998 __Pyx_TraceLine(1231,1,__PYX_ERR(2, 1231, __pyx_L1_error))
17999 __pyx_t_3 = __pyx_v_ndim;
18000 __pyx_t_5 = __pyx_t_3;
18001 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18002 __pyx_v_i = __pyx_t_6;
18011 __Pyx_TraceLine(1232,1,__PYX_ERR(2, 1232, __pyx_L1_error))
18012 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
18021 __Pyx_TraceLine(1233,1,__PYX_ERR(2, 1233, __pyx_L1_error))
18022 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
18032 __Pyx_TraceLine(1235,1,__PYX_ERR(2, 1235, __pyx_L1_error))
18033 (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
18042 __Pyx_TraceLine(1239,1,__PYX_ERR(2, 1239, __pyx_L1_error))
18043 __pyx_t_3 = __pyx_v_ndim;
18044 __pyx_t_5 = __pyx_t_3;
18045 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18046 __pyx_v_i = __pyx_t_6;
18055 __Pyx_TraceLine(1240,1,__PYX_ERR(2, 1240, __pyx_L1_error))
18056 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
18066 __Pyx_TraceLine(1241,1,__PYX_ERR(2, 1241, __pyx_L1_error))
18067 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
18086 __Pyx_TraceLine(1243,1,__PYX_ERR(2, 1243, __pyx_L1_error))
18087 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
18097 __Pyx_TraceLine(1244,1,__PYX_ERR(2, 1244, __pyx_L1_error))
18098 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
18117 __Pyx_TraceLine(1246,1,__PYX_ERR(2, 1246, __pyx_L1_error))
18119 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
18130 __Pyx_TraceLine(1248,1,__PYX_ERR(2, 1248, __pyx_L1_error))
18131 __pyx_r = __pyx_v_result;
18146 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18148 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
18150 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18155 __Pyx_TraceReturn(Py_None, 1);
18167 static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
18169 __Pyx_TraceDeclarations
18170 __Pyx_RefNannyDeclarations
18171 PyObject *__pyx_t_1 = NULL;
18172 PyObject *__pyx_t_2 = NULL;
18173 PyObject *__pyx_t_3 = NULL;
18174 PyObject *__pyx_t_4 = NULL;
18175 int __pyx_lineno = 0;
18176 const char *__pyx_filename = NULL;
18177 int __pyx_clineno = 0;
18179 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18181 __Pyx_RefNannySetupContext(
"_err_extents", 0);
18182 __Pyx_TraceCall(
"_err_extents", __pyx_f[2], 1253, 0, __PYX_ERR(2, 1253, __pyx_L1_error));
18191 __Pyx_TraceLine(1256,0,__PYX_ERR(2, 1256, __pyx_L1_error))
18192 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error)
18193 __Pyx_GOTREF(__pyx_t_1);
18194 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error)
18195 __Pyx_GOTREF(__pyx_t_2);
18196 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error)
18197 __Pyx_GOTREF(__pyx_t_3);
18198 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error)
18199 __Pyx_GOTREF(__pyx_t_4);
18200 __Pyx_GIVEREF(__pyx_t_1);
18201 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
18202 __Pyx_GIVEREF(__pyx_t_2);
18203 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
18204 __Pyx_GIVEREF(__pyx_t_3);
18205 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
18217 __Pyx_TraceLine(1255,0,__PYX_ERR(2, 1255, __pyx_L1_error))
18218 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error)
18219 __Pyx_GOTREF(__pyx_t_3);
18220 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18221 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error)
18222 __Pyx_GOTREF(__pyx_t_4);
18223 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18224 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
18225 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18226 __PYX_ERR(2, 1255, __pyx_L1_error)
18238 __Pyx_XDECREF(__pyx_t_1);
18239 __Pyx_XDECREF(__pyx_t_2);
18240 __Pyx_XDECREF(__pyx_t_3);
18241 __Pyx_XDECREF(__pyx_t_4);
18242 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
18244 __Pyx_TraceReturn(Py_None, 0);
18245 __Pyx_RefNannyFinishContext();
18247 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18260 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
18262 __Pyx_TraceDeclarations
18263 __Pyx_RefNannyDeclarations
18264 PyObject *__pyx_t_1 = NULL;
18265 PyObject *__pyx_t_2 = NULL;
18266 PyObject *__pyx_t_3 = NULL;
18267 PyObject *__pyx_t_4 = NULL;
18268 int __pyx_lineno = 0;
18269 const char *__pyx_filename = NULL;
18270 int __pyx_clineno = 0;
18272 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18274 __Pyx_RefNannySetupContext(
"_err_dim", 0);
18275 __Pyx_TraceCall(
"_err_dim", __pyx_f[2], 1259, 0, __PYX_ERR(2, 1259, __pyx_L1_error));
18276 __Pyx_INCREF(__pyx_v_error);
18285 __Pyx_TraceLine(1260,0,__PYX_ERR(2, 1260, __pyx_L1_error))
18286 __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error)
18287 __Pyx_GOTREF(__pyx_t_2);
18288 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error)
18289 __Pyx_GOTREF(__pyx_t_3);
18290 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error)
18291 __Pyx_GOTREF(__pyx_t_4);
18292 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18293 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18294 __Pyx_INCREF(__pyx_v_error);
18295 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
18296 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
18297 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
18298 if (likely(__pyx_t_2)) {
18299 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
18300 __Pyx_INCREF(__pyx_t_2);
18301 __Pyx_INCREF(
function);
18302 __Pyx_DECREF_SET(__pyx_t_3,
function);
18305 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
18306 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18307 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18308 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error)
18309 __Pyx_GOTREF(__pyx_t_1);
18310 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18311 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18312 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18313 __PYX_ERR(2, 1260, __pyx_L1_error)
18325 __Pyx_XDECREF(__pyx_t_1);
18326 __Pyx_XDECREF(__pyx_t_2);
18327 __Pyx_XDECREF(__pyx_t_3);
18328 __Pyx_XDECREF(__pyx_t_4);
18329 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
18331 __Pyx_XDECREF(__pyx_v_error);
18332 __Pyx_TraceReturn(Py_None, 0);
18333 __Pyx_RefNannyFinishContext();
18335 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18348 static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
18350 __Pyx_TraceDeclarations
18351 __Pyx_RefNannyDeclarations
18353 PyObject *__pyx_t_2 = NULL;
18354 PyObject *__pyx_t_3 = NULL;
18355 PyObject *__pyx_t_4 = NULL;
18356 PyObject *__pyx_t_5 = NULL;
18357 int __pyx_lineno = 0;
18358 const char *__pyx_filename = NULL;
18359 int __pyx_clineno = 0;
18361 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18363 __Pyx_RefNannySetupContext(
"_err", 0);
18364 __Pyx_TraceCall(
"_err", __pyx_f[2], 1263, 0, __PYX_ERR(2, 1263, __pyx_L1_error));
18365 __Pyx_INCREF(__pyx_v_error);
18374 __Pyx_TraceLine(1264,0,__PYX_ERR(2, 1264, __pyx_L1_error))
18375 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
18376 if (unlikely(__pyx_t_1)) {
18385 __Pyx_TraceLine(1265,0,__PYX_ERR(2, 1265, __pyx_L1_error))
18386 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error)
18387 __Pyx_GOTREF(__pyx_t_3);
18388 __Pyx_INCREF(__pyx_v_error);
18389 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
18390 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
18391 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
18392 if (likely(__pyx_t_5)) {
18393 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
18394 __Pyx_INCREF(__pyx_t_5);
18395 __Pyx_INCREF(
function);
18396 __Pyx_DECREF_SET(__pyx_t_4,
function);
18399 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
18400 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18401 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18402 if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error)
18403 __Pyx_GOTREF(__pyx_t_2);
18404 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18405 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18406 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18407 __PYX_ERR(2, 1265, __pyx_L1_error)
18425 __Pyx_TraceLine(1267,0,__PYX_ERR(2, 1267, __pyx_L1_error))
18427 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
18428 __PYX_ERR(2, 1267, __pyx_L1_error)
18441 __Pyx_XDECREF(__pyx_t_2);
18442 __Pyx_XDECREF(__pyx_t_3);
18443 __Pyx_XDECREF(__pyx_t_4);
18444 __Pyx_XDECREF(__pyx_t_5);
18445 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
18447 __Pyx_XDECREF(__pyx_v_error);
18448 __Pyx_TraceReturn(Py_None, 0);
18449 __Pyx_RefNannyFinishContext();
18451 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18464 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst,
int __pyx_v_src_ndim,
int __pyx_v_dst_ndim,
int __pyx_v_dtype_is_object) {
18465 void *__pyx_v_tmpdata;
18466 size_t __pyx_v_itemsize;
18468 char __pyx_v_order;
18469 int __pyx_v_broadcasting;
18470 int __pyx_v_direct_copy;
18471 __Pyx_memviewslice __pyx_v_tmp;
18474 __Pyx_TraceDeclarations
18475 Py_ssize_t __pyx_t_1;
18483 int __pyx_lineno = 0;
18484 const char *__pyx_filename = NULL;
18485 int __pyx_clineno = 0;
18486 __Pyx_TraceCall(
"memoryview_copy_contents", __pyx_f[2], 1270, 1, __PYX_ERR(2, 1270, __pyx_L1_error));
18495 __Pyx_TraceLine(1278,1,__PYX_ERR(2, 1278, __pyx_L1_error))
18496 __pyx_v_tmpdata = NULL;
18505 __Pyx_TraceLine(1279,1,__PYX_ERR(2, 1279, __pyx_L1_error))
18506 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
18507 __pyx_v_itemsize = __pyx_t_1;
18516 __Pyx_TraceLine(1281,1,__PYX_ERR(2, 1281, __pyx_L1_error))
18517 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
18526 __Pyx_TraceLine(1282,1,__PYX_ERR(2, 1282, __pyx_L1_error))
18527 __pyx_v_broadcasting = 0;
18536 __Pyx_TraceLine(1283,1,__PYX_ERR(2, 1283, __pyx_L1_error))
18537 __pyx_v_direct_copy = 0;
18546 __Pyx_TraceLine(1286,1,__PYX_ERR(2, 1286, __pyx_L1_error))
18547 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
18557 __Pyx_TraceLine(1287,1,__PYX_ERR(2, 1287, __pyx_L1_error))
18558 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
18577 __Pyx_TraceLine(1288,1,__PYX_ERR(2, 1288, __pyx_L1_error))
18578 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
18588 __Pyx_TraceLine(1289,1,__PYX_ERR(2, 1289, __pyx_L1_error))
18589 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
18608 __Pyx_TraceLine(1291,1,__PYX_ERR(2, 1291, __pyx_L1_error))
18609 __pyx_t_3 = __pyx_v_dst_ndim;
18610 __pyx_t_4 = __pyx_v_src_ndim;
18611 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
18612 __pyx_t_5 = __pyx_t_3;
18614 __pyx_t_5 = __pyx_t_4;
18616 __pyx_v_ndim = __pyx_t_5;
18625 __Pyx_TraceLine(1293,1,__PYX_ERR(2, 1293, __pyx_L1_error))
18626 __pyx_t_5 = __pyx_v_ndim;
18627 __pyx_t_3 = __pyx_t_5;
18628 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18629 __pyx_v_i = __pyx_t_4;
18638 __Pyx_TraceLine(1294,1,__PYX_ERR(2, 1294, __pyx_L1_error))
18639 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
18649 __Pyx_TraceLine(1295,1,__PYX_ERR(2, 1295, __pyx_L1_error))
18650 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
18660 __Pyx_TraceLine(1296,1,__PYX_ERR(2, 1296, __pyx_L1_error))
18661 __pyx_v_broadcasting = 1;
18670 __Pyx_TraceLine(1297,1,__PYX_ERR(2, 1297, __pyx_L1_error))
18671 (__pyx_v_src.strides[__pyx_v_i]) = 0;
18690 __Pyx_TraceLine(1299,1,__PYX_ERR(2, 1299, __pyx_L1_error))
18692 __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i]));
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error)
18712 __Pyx_TraceLine(1301,1,__PYX_ERR(2, 1301, __pyx_L1_error))
18713 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
18723 __Pyx_TraceLine(1302,1,__PYX_ERR(2, 1302, __pyx_L1_error))
18724 __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Dimension %d is not direct"), __pyx_v_i);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error)
18743 __Pyx_TraceLine(1304,1,__PYX_ERR(2, 1304, __pyx_L1_error))
18744 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
18754 __Pyx_TraceLine(1306,1,__PYX_ERR(2, 1306, __pyx_L1_error))
18755 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
18765 __Pyx_TraceLine(1307,1,__PYX_ERR(2, 1307, __pyx_L1_error))
18766 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
18784 __Pyx_TraceLine(1309,1,__PYX_ERR(2, 1309, __pyx_L1_error))
18785 __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim);
if (unlikely(__pyx_t_7 == ((
void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error)
18786 __pyx_v_tmpdata = __pyx_t_7;
18795 __Pyx_TraceLine(1310,1,__PYX_ERR(2, 1310, __pyx_L1_error))
18796 __pyx_v_src = __pyx_v_tmp;
18814 __Pyx_TraceLine(1312,1,__PYX_ERR(2, 1312, __pyx_L1_error))
18815 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
18825 __Pyx_TraceLine(1315,1,__PYX_ERR(2, 1315, __pyx_L1_error))
18826 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
18836 __Pyx_TraceLine(1316,1,__PYX_ERR(2, 1316, __pyx_L1_error))
18837 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
18856 __Pyx_TraceLine(1317,1,__PYX_ERR(2, 1317, __pyx_L1_error))
18857 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
18867 __Pyx_TraceLine(1318,1,__PYX_ERR(2, 1318, __pyx_L1_error))
18868 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
18887 __Pyx_TraceLine(1320,1,__PYX_ERR(2, 1320, __pyx_L1_error))
18888 __pyx_t_2 = (__pyx_v_direct_copy != 0);
18898 __Pyx_TraceLine(1322,1,__PYX_ERR(2, 1322, __pyx_L1_error))
18899 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
18908 __Pyx_TraceLine(1323,1,__PYX_ERR(2, 1323, __pyx_L1_error))
18909 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
18918 __Pyx_TraceLine(1324,1,__PYX_ERR(2, 1324, __pyx_L1_error))
18919 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
18928 __Pyx_TraceLine(1325,1,__PYX_ERR(2, 1325, __pyx_L1_error))
18929 free(__pyx_v_tmpdata);
18938 __Pyx_TraceLine(1326,1,__PYX_ERR(2, 1326, __pyx_L1_error))
18967 __Pyx_TraceLine(1328,1,__PYX_ERR(2, 1328, __pyx_L1_error))
18968 __pyx_t_2 = (__pyx_v_order ==
'F');
18970 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
18972 __pyx_t_8 = (__pyx_t_2 != 0);
18982 __Pyx_TraceLine(1331,1,__PYX_ERR(2, 1331, __pyx_L1_error))
18983 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(2, 1331, __pyx_L1_error)
18992 __Pyx_TraceLine(1332,1,__PYX_ERR(2, 1332, __pyx_L1_error))
18993 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(2, 1332, __pyx_L1_error)
19011 __Pyx_TraceLine(1334,1,__PYX_ERR(2, 1334, __pyx_L1_error))
19012 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19021 __Pyx_TraceLine(1335,1,__PYX_ERR(2, 1335, __pyx_L1_error))
19022 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
19031 __Pyx_TraceLine(1336,1,__PYX_ERR(2, 1336, __pyx_L1_error))
19032 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19041 __Pyx_TraceLine(1338,1,__PYX_ERR(2, 1338, __pyx_L1_error))
19042 free(__pyx_v_tmpdata);
19051 __Pyx_TraceLine(1339,1,__PYX_ERR(2, 1339, __pyx_L1_error))
19067 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19069 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19071 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19076 __Pyx_TraceReturn(Py_None, 1);
19088 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
19090 int __pyx_v_offset;
19091 __Pyx_TraceDeclarations
19095 int __pyx_lineno = 0;
19096 const char *__pyx_filename = NULL;
19097 int __pyx_clineno = 0;
19098 __Pyx_TraceCall(
"broadcast_leading", __pyx_f[2], 1342, 1, __PYX_ERR(2, 1342, __pyx_L1_error));
19107 __Pyx_TraceLine(1346,1,__PYX_ERR(2, 1346, __pyx_L1_error))
19108 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
19117 __Pyx_TraceLine(1348,1,__PYX_ERR(2, 1348, __pyx_L1_error))
19118 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
19119 __pyx_v_i = __pyx_t_1;
19128 __Pyx_TraceLine(1349,1,__PYX_ERR(2, 1349, __pyx_L1_error))
19129 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
19138 __Pyx_TraceLine(1350,1,__PYX_ERR(2, 1350, __pyx_L1_error))
19139 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
19148 __Pyx_TraceLine(1351,1,__PYX_ERR(2, 1351, __pyx_L1_error))
19149 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
19159 __Pyx_TraceLine(1353,1,__PYX_ERR(2, 1353, __pyx_L1_error))
19160 __pyx_t_1 = __pyx_v_offset;
19161 __pyx_t_2 = __pyx_t_1;
19162 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19163 __pyx_v_i = __pyx_t_3;
19172 __Pyx_TraceLine(1354,1,__PYX_ERR(2, 1354, __pyx_L1_error))
19173 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
19182 __Pyx_TraceLine(1355,1,__PYX_ERR(2, 1355, __pyx_L1_error))
19183 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
19192 __Pyx_TraceLine(1356,1,__PYX_ERR(2, 1356, __pyx_L1_error))
19193 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
19207 __Pyx_WriteUnraisable(
"View.MemoryView.broadcast_leading", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
19209 __Pyx_TraceReturn(Py_None, 1);
19220 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_dtype_is_object,
int __pyx_v_ndim,
int __pyx_v_inc) {
19221 __Pyx_TraceDeclarations
19223 int __pyx_lineno = 0;
19224 const char *__pyx_filename = NULL;
19225 int __pyx_clineno = 0;
19226 __Pyx_TraceCall(
"refcount_copying", __pyx_f[2], 1364, 1, __PYX_ERR(2, 1364, __pyx_L1_error));
19235 __Pyx_TraceLine(1368,1,__PYX_ERR(2, 1368, __pyx_L1_error))
19236 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
19246 __Pyx_TraceLine(1369,1,__PYX_ERR(2, 1369, __pyx_L1_error))
19247 __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
19269 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_copying", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
19271 __Pyx_TraceReturn(Py_None, 1);
19282 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
19283 __Pyx_TraceDeclarations
19284 __Pyx_RefNannyDeclarations
19285 int __pyx_lineno = 0;
19286 const char *__pyx_filename = NULL;
19287 int __pyx_clineno = 0;
19289 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19291 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
19292 __Pyx_TraceCall(
"refcount_objects_in_slice_with_gil", __pyx_f[2], 1373, 0, __PYX_ERR(2, 1373, __pyx_L1_error));
19301 __Pyx_TraceLine(1376,0,__PYX_ERR(2, 1376, __pyx_L1_error))
19302 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
19315 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_objects_in_slice_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
19317 __Pyx_TraceReturn(Py_None, 0);
19318 __Pyx_RefNannyFinishContext();
19320 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19332 static void __pyx_memoryview_refcount_objects_in_slice(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
19333 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19334 __Pyx_TraceDeclarations
19335 __Pyx_RefNannyDeclarations
19336 Py_ssize_t __pyx_t_1;
19337 Py_ssize_t __pyx_t_2;
19338 Py_ssize_t __pyx_t_3;
19340 int __pyx_lineno = 0;
19341 const char *__pyx_filename = NULL;
19342 int __pyx_clineno = 0;
19343 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
19344 __Pyx_TraceCall(
"refcount_objects_in_slice", __pyx_f[2], 1379, 0, __PYX_ERR(2, 1379, __pyx_L1_error));
19353 __Pyx_TraceLine(1383,0,__PYX_ERR(2, 1383, __pyx_L1_error))
19354 __pyx_t_1 = (__pyx_v_shape[0]);
19355 __pyx_t_2 = __pyx_t_1;
19356 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19357 __pyx_v_i = __pyx_t_3;
19366 __Pyx_TraceLine(1384,0,__PYX_ERR(2, 1384, __pyx_L1_error))
19367 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
19377 __Pyx_TraceLine(1385,0,__PYX_ERR(2, 1385, __pyx_L1_error))
19378 __pyx_t_4 = (__pyx_v_inc != 0);
19388 __Pyx_TraceLine(1386,0,__PYX_ERR(2, 1386, __pyx_L1_error))
19389 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
19408 __Pyx_TraceLine(1388,0,__PYX_ERR(2, 1388, __pyx_L1_error))
19410 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
19431 __Pyx_TraceLine(1390,0,__PYX_ERR(2, 1390, __pyx_L1_error))
19441 __Pyx_TraceLine(1391,0,__PYX_ERR(2, 1391, __pyx_L1_error))
19442 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
19453 __Pyx_TraceLine(1393,0,__PYX_ERR(2, 1393, __pyx_L1_error))
19454 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
19468 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_objects_in_slice", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
19470 __Pyx_TraceReturn(Py_None, 0);
19471 __Pyx_RefNannyFinishContext();
19482 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item,
int __pyx_v_dtype_is_object) {
19483 __Pyx_TraceDeclarations
19484 int __pyx_lineno = 0;
19485 const char *__pyx_filename = NULL;
19486 int __pyx_clineno = 0;
19487 __Pyx_TraceCall(
"slice_assign_scalar", __pyx_f[2], 1399, 1, __PYX_ERR(2, 1399, __pyx_L1_error));
19496 __Pyx_TraceLine(1402,1,__PYX_ERR(2, 1402, __pyx_L1_error))
19497 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19506 __Pyx_TraceLine(1403,1,__PYX_ERR(2, 1403, __pyx_L1_error))
19507 __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
19516 __Pyx_TraceLine(1405,1,__PYX_ERR(2, 1405, __pyx_L1_error))
19517 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19530 __Pyx_WriteUnraisable(
"View.MemoryView.slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
19532 __Pyx_TraceReturn(Py_None, 1);
19543 static void __pyx_memoryview__slice_assign_scalar(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item) {
19544 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19545 Py_ssize_t __pyx_v_stride;
19546 Py_ssize_t __pyx_v_extent;
19547 __Pyx_TraceDeclarations
19549 Py_ssize_t __pyx_t_2;
19550 Py_ssize_t __pyx_t_3;
19551 Py_ssize_t __pyx_t_4;
19552 int __pyx_lineno = 0;
19553 const char *__pyx_filename = NULL;
19554 int __pyx_clineno = 0;
19555 __Pyx_TraceCall(
"_slice_assign_scalar", __pyx_f[2], 1409, 1, __PYX_ERR(2, 1409, __pyx_L1_error));
19564 __Pyx_TraceLine(1413,1,__PYX_ERR(2, 1413, __pyx_L1_error))
19565 __pyx_v_stride = (__pyx_v_strides[0]);
19574 __Pyx_TraceLine(1414,1,__PYX_ERR(2, 1414, __pyx_L1_error))
19575 __pyx_v_extent = (__pyx_v_shape[0]);
19584 __Pyx_TraceLine(1416,1,__PYX_ERR(2, 1416, __pyx_L1_error))
19585 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
19595 __Pyx_TraceLine(1417,1,__PYX_ERR(2, 1417, __pyx_L1_error))
19596 __pyx_t_2 = __pyx_v_extent;
19597 __pyx_t_3 = __pyx_t_2;
19598 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19599 __pyx_v_i = __pyx_t_4;
19608 __Pyx_TraceLine(1418,1,__PYX_ERR(2, 1418, __pyx_L1_error))
19609 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
19618 __Pyx_TraceLine(1419,1,__PYX_ERR(2, 1419, __pyx_L1_error))
19619 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19639 __Pyx_TraceLine(1421,1,__PYX_ERR(2, 1421, __pyx_L1_error))
19641 __pyx_t_2 = __pyx_v_extent;
19642 __pyx_t_3 = __pyx_t_2;
19643 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19644 __pyx_v_i = __pyx_t_4;
19653 __Pyx_TraceLine(1422,1,__PYX_ERR(2, 1422, __pyx_L1_error))
19654 __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
19663 __Pyx_TraceLine(1424,1,__PYX_ERR(2, 1424, __pyx_L1_error))
19664 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19680 __Pyx_WriteUnraisable(
"View.MemoryView._slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
19682 __Pyx_TraceReturn(Py_None, 1);
19692 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
19693 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {
"__pyx_unpickle_Enum", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
19694 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19695 PyObject *__pyx_v___pyx_type = 0;
19696 long __pyx_v___pyx_checksum;
19697 PyObject *__pyx_v___pyx_state = 0;
19698 int __pyx_lineno = 0;
19699 const char *__pyx_filename = NULL;
19700 int __pyx_clineno = 0;
19701 PyObject *__pyx_r = 0;
19702 __Pyx_RefNannyDeclarations
19703 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
19705 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
19706 PyObject* values[3] = {0,0,0};
19707 if (unlikely(__pyx_kwds)) {
19708 Py_ssize_t kw_args;
19709 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19710 switch (pos_args) {
19711 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19712 CYTHON_FALLTHROUGH;
19713 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19714 CYTHON_FALLTHROUGH;
19715 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19716 CYTHON_FALLTHROUGH;
19718 default:
goto __pyx_L5_argtuple_error;
19720 kw_args = PyDict_Size(__pyx_kwds);
19721 switch (pos_args) {
19723 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
19724 else goto __pyx_L5_argtuple_error;
19725 CYTHON_FALLTHROUGH;
19727 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
19729 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
19731 CYTHON_FALLTHROUGH;
19733 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
19735 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
19738 if (unlikely(kw_args > 0)) {
19739 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
19741 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19742 goto __pyx_L5_argtuple_error;
19744 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19745 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19746 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19748 __pyx_v___pyx_type = values[0];
19749 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
19750 __pyx_v___pyx_state = values[2];
19752 goto __pyx_L4_argument_unpacking_done;
19753 __pyx_L5_argtuple_error:;
19754 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
19756 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19757 __Pyx_RefNannyFinishContext();
19759 __pyx_L4_argument_unpacking_done:;
19760 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
19763 __Pyx_RefNannyFinishContext();
19767 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
19768 PyObject *__pyx_v___pyx_PickleError = 0;
19769 PyObject *__pyx_v___pyx_result = 0;
19770 PyObject *__pyx_r = NULL;
19771 __Pyx_TraceDeclarations
19772 __Pyx_RefNannyDeclarations
19773 PyObject *__pyx_t_1 = NULL;
19776 PyObject *__pyx_t_4 = NULL;
19777 PyObject *__pyx_t_5 = NULL;
19778 PyObject *__pyx_t_6 = NULL;
19779 int __pyx_lineno = 0;
19780 const char *__pyx_filename = NULL;
19781 int __pyx_clineno = 0;
19782 __Pyx_TraceFrameInit(__pyx_codeobj__21)
19783 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
19784 __Pyx_TraceCall(
"__pyx_unpickle_Enum", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
19793 __Pyx_TraceLine(4,0,__PYX_ERR(2, 4, __pyx_L1_error))
19794 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
19795 __Pyx_GOTREF(__pyx_t_1);
19796 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__22, Py_NE));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error)
19797 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19798 __pyx_t_3 = (__pyx_t_2 != 0);
19808 __Pyx_TraceLine(5,0,__PYX_ERR(2, 5, __pyx_L1_error))
19809 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
19810 __Pyx_GOTREF(__pyx_t_1);
19811 __Pyx_INCREF(__pyx_n_s_PickleError);
19812 __Pyx_GIVEREF(__pyx_n_s_PickleError);
19813 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError);
19814 __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
19815 __Pyx_GOTREF(__pyx_t_4);
19816 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19817 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
19818 __Pyx_GOTREF(__pyx_t_1);
19819 __Pyx_INCREF(__pyx_t_1);
19820 __pyx_v___pyx_PickleError = __pyx_t_1;
19821 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19822 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19831 __Pyx_TraceLine(6,0,__PYX_ERR(2, 6, __pyx_L1_error))
19832 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
19833 __Pyx_GOTREF(__pyx_t_1);
19834 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error)
19835 __Pyx_GOTREF(__pyx_t_5);
19836 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19837 __Pyx_INCREF(__pyx_v___pyx_PickleError);
19838 __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL;
19839 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
19840 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
19841 if (likely(__pyx_t_6)) {
19842 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
19843 __Pyx_INCREF(__pyx_t_6);
19844 __Pyx_INCREF(
function);
19845 __Pyx_DECREF_SET(__pyx_t_1,
function);
19848 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
19849 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
19850 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19851 if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
19852 __Pyx_GOTREF(__pyx_t_4);
19853 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19854 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
19855 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19856 __PYX_ERR(2, 6, __pyx_L1_error)
19874 __Pyx_TraceLine(7,0,__PYX_ERR(2, 7, __pyx_L1_error))
19875 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error)
19876 __Pyx_GOTREF(__pyx_t_1);
19878 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
19879 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
19880 if (likely(__pyx_t_5)) {
19881 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
19882 __Pyx_INCREF(__pyx_t_5);
19883 __Pyx_INCREF(
function);
19884 __Pyx_DECREF_SET(__pyx_t_1,
function);
19887 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type);
19888 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19889 if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error)
19890 __Pyx_GOTREF(__pyx_t_4);
19891 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19892 __pyx_v___pyx_result = __pyx_t_4;
19902 __Pyx_TraceLine(8,0,__PYX_ERR(2, 8, __pyx_L1_error))
19903 __pyx_t_3 = (__pyx_v___pyx_state != Py_None);
19904 __pyx_t_2 = (__pyx_t_3 != 0);
19914 __Pyx_TraceLine(9,0,__PYX_ERR(2, 9, __pyx_L1_error))
19915 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
19916 __pyx_t_4 = __pyx_unpickle_Enum__set_state(((
struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error)
19917 __Pyx_GOTREF(__pyx_t_4);
19918 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19936 __Pyx_TraceLine(10,0,__PYX_ERR(2, 10, __pyx_L1_error))
19937 __Pyx_XDECREF(__pyx_r);
19938 __Pyx_INCREF(__pyx_v___pyx_result);
19939 __pyx_r = __pyx_v___pyx_result;
19950 __Pyx_XDECREF(__pyx_t_1);
19951 __Pyx_XDECREF(__pyx_t_4);
19952 __Pyx_XDECREF(__pyx_t_5);
19953 __Pyx_XDECREF(__pyx_t_6);
19954 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19957 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
19958 __Pyx_XDECREF(__pyx_v___pyx_result);
19959 __Pyx_XGIVEREF(__pyx_r);
19960 __Pyx_TraceReturn(__pyx_r, 0);
19961 __Pyx_RefNannyFinishContext();
19973 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
19974 PyObject *__pyx_r = NULL;
19975 __Pyx_TraceDeclarations
19976 __Pyx_RefNannyDeclarations
19977 PyObject *__pyx_t_1 = NULL;
19979 Py_ssize_t __pyx_t_3;
19982 PyObject *__pyx_t_6 = NULL;
19983 PyObject *__pyx_t_7 = NULL;
19984 PyObject *__pyx_t_8 = NULL;
19985 int __pyx_lineno = 0;
19986 const char *__pyx_filename = NULL;
19987 int __pyx_clineno = 0;
19988 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
19989 __Pyx_TraceCall(
"__pyx_unpickle_Enum__set_state", __pyx_f[2], 11, 0, __PYX_ERR(2, 11, __pyx_L1_error));
19998 __Pyx_TraceLine(12,0,__PYX_ERR(2, 12, __pyx_L1_error))
19999 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20000 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20001 __PYX_ERR(2, 12, __pyx_L1_error)
20003 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
20004 __Pyx_GOTREF(__pyx_t_1);
20005 __Pyx_GIVEREF(__pyx_t_1);
20006 __Pyx_GOTREF(__pyx_v___pyx_result->name);
20007 __Pyx_DECREF(__pyx_v___pyx_result->name);
20008 __pyx_v___pyx_result->name = __pyx_t_1;
20017 __Pyx_TraceLine(13,0,__PYX_ERR(2, 13, __pyx_L1_error))
20018 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20019 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
20020 __PYX_ERR(2, 13, __pyx_L1_error)
20022 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state);
if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
20023 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
20026 __pyx_t_2 = __pyx_t_4;
20027 goto __pyx_L4_bool_binop_done;
20029 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
20030 __pyx_t_5 = (__pyx_t_4 != 0);
20031 __pyx_t_2 = __pyx_t_5;
20032 __pyx_L4_bool_binop_done:;
20040 __Pyx_TraceLine(14,0,__PYX_ERR(2, 14, __pyx_L1_error))
20041 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
20042 __Pyx_GOTREF(__pyx_t_6);
20043 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
20044 __Pyx_GOTREF(__pyx_t_7);
20045 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20046 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20047 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20048 __PYX_ERR(2, 14, __pyx_L1_error)
20050 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
20051 __Pyx_GOTREF(__pyx_t_6);
20053 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
20054 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
20055 if (likely(__pyx_t_8)) {
20056 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_7);
20057 __Pyx_INCREF(__pyx_t_8);
20058 __Pyx_INCREF(
function);
20059 __Pyx_DECREF_SET(__pyx_t_7,
function);
20062 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
20063 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20064 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20065 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
20066 __Pyx_GOTREF(__pyx_t_1);
20067 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20068 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20087 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20090 __Pyx_XDECREF(__pyx_t_1);
20091 __Pyx_XDECREF(__pyx_t_6);
20092 __Pyx_XDECREF(__pyx_t_7);
20093 __Pyx_XDECREF(__pyx_t_8);
20094 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
20097 __Pyx_XGIVEREF(__pyx_r);
20098 __Pyx_TraceReturn(__pyx_r, 0);
20099 __Pyx_RefNannyFinishContext();
20102 static struct __pyx_vtabstruct_array __pyx_vtable_array;
20104 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
20105 struct __pyx_array_obj *p;
20107 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20108 o = (*t->tp_alloc)(t, 0);
20110 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20112 if (unlikely(!o))
return 0;
20113 p = ((
struct __pyx_array_obj *)o);
20114 p->__pyx_vtab = __pyx_vtabptr_array;
20115 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
20116 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
20117 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
20120 Py_DECREF(o); o = 0;
20124 static void __pyx_tp_dealloc_array(PyObject *o) {
20125 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
20126 #if CYTHON_USE_TP_FINALIZE
20127 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
20128 if (PyObject_CallFinalizerFromDealloc(o))
return;
20132 PyObject *etype, *eval, *etb;
20133 PyErr_Fetch(&etype, &eval, &etb);
20134 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20135 __pyx_array___dealloc__(o);
20136 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20137 PyErr_Restore(etype, eval, etb);
20140 Py_CLEAR(p->_format);
20141 (*Py_TYPE(o)->tp_free)(o);
20143 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
20145 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
20146 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20151 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
20153 return __pyx_array___setitem__(o, i, v);
20156 PyErr_Format(PyExc_NotImplementedError,
20157 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20162 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
20163 PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
20164 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
20166 v = __pyx_array___getattr__(o, n);
20171 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
20172 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
20175 static PyMethodDef __pyx_methods_array[] = {
20176 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
20177 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
20178 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
20182 static struct PyGetSetDef __pyx_getsets_array[] = {
20183 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
20187 static PySequenceMethods __pyx_tp_as_sequence_array = {
20188 __pyx_array___len__,
20191 __pyx_sq_item_array,
20200 static PyMappingMethods __pyx_tp_as_mapping_array = {
20201 __pyx_array___len__,
20202 __pyx_array___getitem__,
20203 __pyx_mp_ass_subscript_array,
20206 static PyBufferProcs __pyx_tp_as_buffer_array = {
20207 #if PY_MAJOR_VERSION < 3
20210 #if PY_MAJOR_VERSION < 3
20213 #if PY_MAJOR_VERSION < 3
20216 #if PY_MAJOR_VERSION < 3
20219 __pyx_array_getbuffer,
20223 static PyTypeObject __pyx_type___pyx_array = {
20224 PyVarObject_HEAD_INIT(0, 0)
20225 "imate._c_trace_estimator.py_c_trace_estimator.array",
20226 sizeof(
struct __pyx_array_obj),
20228 __pyx_tp_dealloc_array,
20229 #
if PY_VERSION_HEX < 0x030800b4
20232 #
if PY_VERSION_HEX >= 0x030800b4
20237 #
if PY_MAJOR_VERSION < 3
20240 #
if PY_MAJOR_VERSION >= 3
20245 &__pyx_tp_as_sequence_array,
20246 &__pyx_tp_as_mapping_array,
20250 __pyx_tp_getattro_array,
20252 &__pyx_tp_as_buffer_array,
20253 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
20261 __pyx_methods_array,
20263 __pyx_getsets_array,
20271 __pyx_tp_new_array,
20281 #
if PY_VERSION_HEX >= 0x030400a1
20284 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20287 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20290 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20295 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20296 struct __pyx_MemviewEnum_obj *p;
20298 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20299 o = (*t->tp_alloc)(t, 0);
20301 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20303 if (unlikely(!o))
return 0;
20304 p = ((
struct __pyx_MemviewEnum_obj *)o);
20305 p->name = Py_None; Py_INCREF(Py_None);
20309 static void __pyx_tp_dealloc_Enum(PyObject *o) {
20310 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20311 #if CYTHON_USE_TP_FINALIZE
20312 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
20313 if (PyObject_CallFinalizerFromDealloc(o))
return;
20316 PyObject_GC_UnTrack(o);
20318 (*Py_TYPE(o)->tp_free)(o);
20321 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v,
void *a) {
20323 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20325 e = (*v)(p->name, a);
if (e)
return e;
20330 static int __pyx_tp_clear_Enum(PyObject *o) {
20332 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20333 tmp = ((PyObject*)p->name);
20334 p->name = Py_None; Py_INCREF(Py_None);
20339 static PyMethodDef __pyx_methods_Enum[] = {
20340 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
20341 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
20345 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
20346 PyVarObject_HEAD_INIT(0, 0)
20347 "imate._c_trace_estimator.py_c_trace_estimator.Enum",
20348 sizeof(
struct __pyx_MemviewEnum_obj),
20350 __pyx_tp_dealloc_Enum,
20351 #
if PY_VERSION_HEX < 0x030800b4
20354 #
if PY_VERSION_HEX >= 0x030800b4
20359 #
if PY_MAJOR_VERSION < 3
20362 #
if PY_MAJOR_VERSION >= 3
20365 __pyx_MemviewEnum___repr__,
20375 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20377 __pyx_tp_traverse_Enum,
20378 __pyx_tp_clear_Enum,
20383 __pyx_methods_Enum,
20391 __pyx_MemviewEnum___init__,
20403 #
if PY_VERSION_HEX >= 0x030400a1
20406 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20409 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20412 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20416 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
20418 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
20419 struct __pyx_memoryview_obj *p;
20421 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20422 o = (*t->tp_alloc)(t, 0);
20424 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20426 if (unlikely(!o))
return 0;
20427 p = ((
struct __pyx_memoryview_obj *)o);
20428 p->__pyx_vtab = __pyx_vtabptr_memoryview;
20429 p->obj = Py_None; Py_INCREF(Py_None);
20430 p->_size = Py_None; Py_INCREF(Py_None);
20431 p->_array_interface = Py_None; Py_INCREF(Py_None);
20432 p->view.obj = NULL;
20433 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
20436 Py_DECREF(o); o = 0;
20440 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
20441 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20442 #if CYTHON_USE_TP_FINALIZE
20443 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
20444 if (PyObject_CallFinalizerFromDealloc(o))
return;
20447 PyObject_GC_UnTrack(o);
20449 PyObject *etype, *eval, *etb;
20450 PyErr_Fetch(&etype, &eval, &etb);
20451 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20452 __pyx_memoryview___dealloc__(o);
20453 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20454 PyErr_Restore(etype, eval, etb);
20457 Py_CLEAR(p->_size);
20458 Py_CLEAR(p->_array_interface);
20459 (*Py_TYPE(o)->tp_free)(o);
20462 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v,
void *a) {
20464 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20466 e = (*v)(p->obj, a);
if (e)
return e;
20469 e = (*v)(p->_size, a);
if (e)
return e;
20471 if (p->_array_interface) {
20472 e = (*v)(p->_array_interface, a);
if (e)
return e;
20475 e = (*v)(p->view.obj, a);
if (e)
return e;
20480 static int __pyx_tp_clear_memoryview(PyObject *o) {
20482 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20483 tmp = ((PyObject*)p->obj);
20484 p->obj = Py_None; Py_INCREF(Py_None);
20486 tmp = ((PyObject*)p->_size);
20487 p->_size = Py_None; Py_INCREF(Py_None);
20489 tmp = ((PyObject*)p->_array_interface);
20490 p->_array_interface = Py_None; Py_INCREF(Py_None);
20492 Py_CLEAR(p->view.obj);
20495 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
20497 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
20498 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20503 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
20505 return __pyx_memoryview___setitem__(o, i, v);
20508 PyErr_Format(PyExc_NotImplementedError,
20509 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20514 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
20515 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
20518 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
20519 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
20522 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
20523 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
20526 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
20527 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
20530 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
20531 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
20534 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
20535 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
20538 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
20539 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
20542 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
20543 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
20546 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
20547 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
20550 static PyMethodDef __pyx_methods_memoryview[] = {
20551 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
20552 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
20553 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
20554 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
20555 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
20556 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
20560 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
20561 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
20562 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
20563 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
20564 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
20565 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
20566 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
20567 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
20568 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
20569 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
20573 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
20574 __pyx_memoryview___len__,
20577 __pyx_sq_item_memoryview,
20586 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
20587 __pyx_memoryview___len__,
20588 __pyx_memoryview___getitem__,
20589 __pyx_mp_ass_subscript_memoryview,
20592 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
20593 #if PY_MAJOR_VERSION < 3
20596 #if PY_MAJOR_VERSION < 3
20599 #if PY_MAJOR_VERSION < 3
20602 #if PY_MAJOR_VERSION < 3
20605 __pyx_memoryview_getbuffer,
20609 static PyTypeObject __pyx_type___pyx_memoryview = {
20610 PyVarObject_HEAD_INIT(0, 0)
20611 "imate._c_trace_estimator.py_c_trace_estimator.memoryview",
20612 sizeof(
struct __pyx_memoryview_obj),
20614 __pyx_tp_dealloc_memoryview,
20615 #
if PY_VERSION_HEX < 0x030800b4
20618 #
if PY_VERSION_HEX >= 0x030800b4
20623 #
if PY_MAJOR_VERSION < 3
20626 #
if PY_MAJOR_VERSION >= 3
20629 __pyx_memoryview___repr__,
20631 &__pyx_tp_as_sequence_memoryview,
20632 &__pyx_tp_as_mapping_memoryview,
20635 __pyx_memoryview___str__,
20638 &__pyx_tp_as_buffer_memoryview,
20639 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20641 __pyx_tp_traverse_memoryview,
20642 __pyx_tp_clear_memoryview,
20647 __pyx_methods_memoryview,
20649 __pyx_getsets_memoryview,
20657 __pyx_tp_new_memoryview,
20667 #
if PY_VERSION_HEX >= 0x030400a1
20670 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20673 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20676 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20680 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
20682 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
20683 struct __pyx_memoryviewslice_obj *p;
20684 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
20685 if (unlikely(!o))
return 0;
20686 p = ((
struct __pyx_memoryviewslice_obj *)o);
20687 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
20688 p->from_object = Py_None; Py_INCREF(Py_None);
20689 p->from_slice.memview = NULL;
20693 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
20694 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20695 #if CYTHON_USE_TP_FINALIZE
20696 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
20697 if (PyObject_CallFinalizerFromDealloc(o))
return;
20700 PyObject_GC_UnTrack(o);
20702 PyObject *etype, *eval, *etb;
20703 PyErr_Fetch(&etype, &eval, &etb);
20704 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20705 __pyx_memoryviewslice___dealloc__(o);
20706 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20707 PyErr_Restore(etype, eval, etb);
20709 Py_CLEAR(p->from_object);
20710 PyObject_GC_Track(o);
20711 __pyx_tp_dealloc_memoryview(o);
20714 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v,
void *a) {
20716 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20717 e = __pyx_tp_traverse_memoryview(o, v, a);
if (e)
return e;
20718 if (p->from_object) {
20719 e = (*v)(p->from_object, a);
if (e)
return e;
20724 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
20726 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20727 __pyx_tp_clear_memoryview(o);
20728 tmp = ((PyObject*)p->from_object);
20729 p->from_object = Py_None; Py_INCREF(Py_None);
20731 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
20735 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
20736 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
20739 static PyMethodDef __pyx_methods__memoryviewslice[] = {
20740 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
20741 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
20745 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
20746 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
20750 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
20751 PyVarObject_HEAD_INIT(0, 0)
20752 "imate._c_trace_estimator.py_c_trace_estimator._memoryviewslice",
20753 sizeof(
struct __pyx_memoryviewslice_obj),
20755 __pyx_tp_dealloc__memoryviewslice,
20756 #
if PY_VERSION_HEX < 0x030800b4
20759 #
if PY_VERSION_HEX >= 0x030800b4
20764 #
if PY_MAJOR_VERSION < 3
20767 #
if PY_MAJOR_VERSION >= 3
20770 #
if CYTHON_COMPILING_IN_PYPY
20771 __pyx_memoryview___repr__,
20780 #
if CYTHON_COMPILING_IN_PYPY
20781 __pyx_memoryview___str__,
20788 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20789 "Internal class for passing memoryview slices to Python",
20790 __pyx_tp_traverse__memoryviewslice,
20791 __pyx_tp_clear__memoryviewslice,
20796 __pyx_methods__memoryviewslice,
20798 __pyx_getsets__memoryviewslice,
20806 __pyx_tp_new__memoryviewslice,
20816 #
if PY_VERSION_HEX >= 0x030400a1
20819 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20822 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20825 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20830 static PyMethodDef __pyx_methods[] = {
20834 #if PY_MAJOR_VERSION >= 3
20835 #if CYTHON_PEP489_MULTI_PHASE_INIT
20836 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
20837 static int __pyx_pymod_exec_py_c_trace_estimator(PyObject* module);
20838 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
20839 {Py_mod_create, (
void*)__pyx_pymod_create},
20840 {Py_mod_exec, (
void*)__pyx_pymod_exec_py_c_trace_estimator},
20845 static struct PyModuleDef __pyx_moduledef = {
20846 PyModuleDef_HEAD_INIT,
20847 "py_c_trace_estimator",
20849 #if CYTHON_PEP489_MULTI_PHASE_INIT
20855 #if CYTHON_PEP489_MULTI_PHASE_INIT
20856 __pyx_moduledef_slots,
20865 #ifndef CYTHON_SMALL_CODE
20866 #if defined(__clang__)
20867 #define CYTHON_SMALL_CODE
20868 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
20869 #define CYTHON_SMALL_CODE __attribute__((cold))
20871 #define CYTHON_SMALL_CODE
20875 static __Pyx_StringTabEntry __pyx_string_tab[] = {
20876 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
20877 {&__pyx_n_s_Aop, __pyx_k_Aop,
sizeof(__pyx_k_Aop), 0, 0, 1, 1},
20878 {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri,
sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
20879 {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is,
sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
20880 {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor,
sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
20881 {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi,
sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
20882 {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s,
sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
20883 {&__pyx_kp_u_Data_type_should_be_float32_floa, __pyx_k_Data_type_should_be_float32_floa,
sizeof(__pyx_k_Data_type_should_be_float32_floa), 0, 1, 0, 0},
20884 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
20885 {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr,
sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
20886 {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0,
sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0},
20887 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
20888 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
20889 {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr,
sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
20890 {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d,
sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
20891 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
20892 {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x,
sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
20893 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
20894 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
20895 {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a,
sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
20896 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
20897 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
20898 {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object,
sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
20899 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
20900 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
20901 {&__pyx_n_s_alg_wall_times, __pyx_k_alg_wall_times,
sizeof(__pyx_k_alg_wall_times), 0, 0, 1, 1},
20902 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
20903 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
20904 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
20905 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
20906 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
20907 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
20908 {&__pyx_n_s_confidence_level, __pyx_k_confidence_level,
sizeof(__pyx_k_confidence_level), 0, 0, 1, 1},
20909 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
20910 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
20911 {&__pyx_n_s_converged, __pyx_k_converged,
sizeof(__pyx_k_converged), 0, 0, 1, 1},
20912 {&__pyx_n_s_data_type_name, __pyx_k_data_type_name,
sizeof(__pyx_k_data_type_name), 0, 0, 1, 1},
20913 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
20914 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
20915 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
20916 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
20917 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
20918 {&__pyx_n_s_error_atol, __pyx_k_error_atol,
sizeof(__pyx_k_error_atol), 0, 0, 1, 1},
20919 {&__pyx_n_s_error_rtol, __pyx_k_error_rtol,
sizeof(__pyx_k_error_rtol), 0, 0, 1, 1},
20920 {&__pyx_n_s_exponent, __pyx_k_exponent,
sizeof(__pyx_k_exponent), 0, 0, 1, 1},
20921 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
20922 {&__pyx_n_b_float128, __pyx_k_float128,
sizeof(__pyx_k_float128), 0, 0, 0, 1},
20923 {&__pyx_n_b_float32, __pyx_k_float32,
sizeof(__pyx_k_float32), 0, 0, 0, 1},
20924 {&__pyx_n_b_float64, __pyx_k_float64,
sizeof(__pyx_k_float64), 0, 0, 0, 1},
20925 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
20926 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
20927 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
20928 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
20929 {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi,
sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
20930 {&__pyx_n_s_gram, __pyx_k_gram,
sizeof(__pyx_k_gram), 0, 0, 1, 1},
20931 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
20932 {&__pyx_kp_s_imate__c_trace_estimator_py_c_tr, __pyx_k_imate__c_trace_estimator_py_c_tr,
sizeof(__pyx_k_imate__c_trace_estimator_py_c_tr), 0, 0, 1, 0},
20933 {&__pyx_n_s_imate__c_trace_estimator_py_c_tr_2, __pyx_k_imate__c_trace_estimator_py_c_tr_2,
sizeof(__pyx_k_imate__c_trace_estimator_py_c_tr_2), 0, 0, 1, 1},
20934 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
20935 {&__pyx_n_s_isscalar, __pyx_k_isscalar,
sizeof(__pyx_k_isscalar), 0, 0, 1, 1},
20936 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
20937 {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array,
sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
20938 {&__pyx_n_s_lanczos_degree, __pyx_k_lanczos_degree,
sizeof(__pyx_k_lanczos_degree), 0, 0, 1, 1},
20939 {&__pyx_n_s_lanczos_tol, __pyx_k_lanczos_tol,
sizeof(__pyx_k_lanczos_tol), 0, 0, 1, 1},
20940 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
20941 {&__pyx_n_s_max_num_samples, __pyx_k_max_num_samples,
sizeof(__pyx_k_max_num_samples), 0, 0, 1, 1},
20942 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
20943 {&__pyx_n_s_min_num_samples, __pyx_k_min_num_samples,
sizeof(__pyx_k_min_num_samples), 0, 0, 1, 1},
20944 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
20945 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
20946 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
20947 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
20948 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
20949 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non,
sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
20950 {&__pyx_n_s_num_inquiries, __pyx_k_num_inquiries,
sizeof(__pyx_k_num_inquiries), 0, 0, 1, 1},
20951 {&__pyx_n_s_num_outliers, __pyx_k_num_outliers,
sizeof(__pyx_k_num_outliers), 0, 0, 1, 1},
20952 {&__pyx_n_s_num_samples_used, __pyx_k_num_samples_used,
sizeof(__pyx_k_num_samples_used), 0, 0, 1, 1},
20953 {&__pyx_n_s_num_threads, __pyx_k_num_threads,
sizeof(__pyx_k_num_threads), 0, 0, 1, 1},
20954 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
20955 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
20956 {&__pyx_n_s_outlier_significance_level, __pyx_k_outlier_significance_level,
sizeof(__pyx_k_outlier_significance_level), 0, 0, 1, 1},
20957 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
20958 {&__pyx_n_s_parameters, __pyx_k_parameters,
sizeof(__pyx_k_parameters), 0, 0, 1, 1},
20959 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
20960 {&__pyx_n_s_processed_samples_indices, __pyx_k_processed_samples_indices,
sizeof(__pyx_k_processed_samples_indices), 0, 0, 1, 1},
20961 {&__pyx_n_s_py_matrix_function, __pyx_k_py_matrix_function,
sizeof(__pyx_k_py_matrix_function), 0, 0, 1, 1},
20962 {&__pyx_n_s_pyc_trace_estimator, __pyx_k_pyc_trace_estimator,
sizeof(__pyx_k_pyc_trace_estimator), 0, 0, 1, 1},
20963 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
20964 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
20965 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
20966 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
20967 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
20968 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
20969 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
20970 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
20971 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
20972 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
20973 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
20974 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
20975 {&__pyx_n_s_reorthogonalize, __pyx_k_reorthogonalize,
sizeof(__pyx_k_reorthogonalize), 0, 0, 1, 1},
20976 {&__pyx_n_s_samples, __pyx_k_samples,
sizeof(__pyx_k_samples), 0, 0, 1, 1},
20977 {&__pyx_n_s_seed, __pyx_k_seed,
sizeof(__pyx_k_seed), 0, 0, 1, 1},
20978 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
20979 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
20980 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
20981 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
20982 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
20983 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
20984 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
20985 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
20986 {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect,
sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
20987 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
20988 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
20989 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
20990 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
20991 {&__pyx_n_s_trace, __pyx_k_trace,
sizeof(__pyx_k_trace), 0, 0, 1, 1},
20992 {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data,
sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
20993 {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str,
sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
20994 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
20995 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
20996 {0, 0, 0, 0, 0, 0, 0}
20998 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
20999 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(0, 160, __pyx_L1_error)
21000 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(0, 230, __pyx_L1_error)
21001 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(2, 134, __pyx_L1_error)
21002 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error)
21003 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error)
21004 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error)
21005 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error)
21006 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error)
21012 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
21013 __Pyx_RefNannyDeclarations
21014 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
21023 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Data_type_should_be_float32_floa);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 160, __pyx_L1_error)
21024 __Pyx_GOTREF(__pyx_tuple__2);
21025 __Pyx_GIVEREF(__pyx_tuple__2);
21034 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 134, __pyx_L1_error)
21035 __Pyx_GOTREF(__pyx_tuple__3);
21036 __Pyx_GIVEREF(__pyx_tuple__3);
21045 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 137, __pyx_L1_error)
21046 __Pyx_GOTREF(__pyx_tuple__4);
21047 __Pyx_GIVEREF(__pyx_tuple__4);
21056 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 149, __pyx_L1_error)
21057 __Pyx_GOTREF(__pyx_tuple__5);
21058 __Pyx_GIVEREF(__pyx_tuple__5);
21067 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 177, __pyx_L1_error)
21068 __Pyx_GOTREF(__pyx_tuple__6);
21069 __Pyx_GIVEREF(__pyx_tuple__6);
21078 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 193, __pyx_L1_error)
21079 __Pyx_GOTREF(__pyx_tuple__7);
21080 __Pyx_GIVEREF(__pyx_tuple__7);
21088 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 2, __pyx_L1_error)
21089 __Pyx_GOTREF(__pyx_tuple__8);
21090 __Pyx_GIVEREF(__pyx_tuple__8);
21097 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 4, __pyx_L1_error)
21098 __Pyx_GOTREF(__pyx_tuple__9);
21099 __Pyx_GIVEREF(__pyx_tuple__9);
21108 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 420, __pyx_L1_error)
21109 __Pyx_GOTREF(__pyx_tuple__10);
21110 __Pyx_GIVEREF(__pyx_tuple__10);
21119 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 497, __pyx_L1_error)
21120 __Pyx_GOTREF(__pyx_tuple__11);
21121 __Pyx_GIVEREF(__pyx_tuple__11);
21130 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 522, __pyx_L1_error)
21131 __Pyx_GOTREF(__pyx_tuple__12);
21132 __Pyx_GIVEREF(__pyx_tuple__12);
21141 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 572, __pyx_L1_error)
21142 __Pyx_GOTREF(__pyx_tuple__13);
21143 __Pyx_GIVEREF(__pyx_tuple__13);
21152 __pyx_tuple__14 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 579, __pyx_L1_error)
21153 __Pyx_GOTREF(__pyx_tuple__14);
21154 __Pyx_INCREF(__pyx_int_neg_1);
21155 __Pyx_GIVEREF(__pyx_int_neg_1);
21156 PyTuple_SET_ITEM(__pyx_tuple__14, 0, __pyx_int_neg_1);
21157 __Pyx_GIVEREF(__pyx_tuple__14);
21165 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 2, __pyx_L1_error)
21166 __Pyx_GOTREF(__pyx_tuple__15);
21167 __Pyx_GIVEREF(__pyx_tuple__15);
21174 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 4, __pyx_L1_error)
21175 __Pyx_GOTREF(__pyx_tuple__16);
21176 __Pyx_GIVEREF(__pyx_tuple__16);
21185 __pyx_slice__17 = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice__17)) __PYX_ERR(2, 684, __pyx_L1_error)
21186 __Pyx_GOTREF(__pyx_slice__17);
21187 __Pyx_GIVEREF(__pyx_slice__17);
21196 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 705, __pyx_L1_error)
21197 __Pyx_GOTREF(__pyx_tuple__18);
21198 __Pyx_GIVEREF(__pyx_tuple__18);
21206 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error)
21207 __Pyx_GOTREF(__pyx_tuple__19);
21208 __Pyx_GIVEREF(__pyx_tuple__19);
21215 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error)
21216 __Pyx_GOTREF(__pyx_tuple__20);
21217 __Pyx_GIVEREF(__pyx_tuple__20);
21218 __pyx_tuple__22 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877);
if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error)
21219 __Pyx_GOTREF(__pyx_tuple__22);
21220 __Pyx_GIVEREF(__pyx_tuple__22);
21229 __pyx_tuple__23 = PyTuple_Pack(26, __pyx_n_s_Aop, __pyx_n_s_parameters, __pyx_n_s_num_inquiries, __pyx_n_s_py_matrix_function, __pyx_n_s_gram, __pyx_n_s_exponent, __pyx_n_s_reorthogonalize, __pyx_n_s_seed, __pyx_n_s_lanczos_degree, __pyx_n_s_lanczos_tol, __pyx_n_s_min_num_samples, __pyx_n_s_max_num_samples, __pyx_n_s_error_atol, __pyx_n_s_error_rtol, __pyx_n_s_confidence_level, __pyx_n_s_outlier_significance_level, __pyx_n_s_num_threads, __pyx_n_s_data_type_name, __pyx_n_s_trace, __pyx_n_s_error, __pyx_n_s_samples, __pyx_n_s_processed_samples_indices, __pyx_n_s_num_samples_used, __pyx_n_s_num_outliers, __pyx_n_s_converged, __pyx_n_s_alg_wall_times);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 39, __pyx_L1_error)
21230 __Pyx_GOTREF(__pyx_tuple__23);
21231 __Pyx_GIVEREF(__pyx_tuple__23);
21232 __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(26, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate__c_trace_estimator_py_c_tr, __pyx_n_s_pyc_trace_estimator, 39, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 39, __pyx_L1_error)
21241 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 287, __pyx_L1_error)
21242 __Pyx_GOTREF(__pyx_tuple__24);
21243 __Pyx_GIVEREF(__pyx_tuple__24);
21252 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 288, __pyx_L1_error)
21253 __Pyx_GOTREF(__pyx_tuple__25);
21254 __Pyx_GIVEREF(__pyx_tuple__25);
21263 __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 289, __pyx_L1_error)
21264 __Pyx_GOTREF(__pyx_tuple__26);
21265 __Pyx_GIVEREF(__pyx_tuple__26);
21274 __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 292, __pyx_L1_error)
21275 __Pyx_GOTREF(__pyx_tuple__27);
21276 __Pyx_GIVEREF(__pyx_tuple__27);
21285 __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 293, __pyx_L1_error)
21286 __Pyx_GOTREF(__pyx_tuple__28);
21287 __Pyx_GIVEREF(__pyx_tuple__28);
21294 __pyx_tuple__29 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result);
if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 1, __pyx_L1_error)
21295 __Pyx_GOTREF(__pyx_tuple__29);
21296 __Pyx_GIVEREF(__pyx_tuple__29);
21297 __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(2, 1, __pyx_L1_error)
21298 __Pyx_RefNannyFinishContext();
21301 __Pyx_RefNannyFinishContext();
21305 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
21307 __Pyx_init_assertions_enabled();
21309 if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
21311 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21312 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
21313 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21314 __pyx_int_112105877 = PyInt_FromLong(112105877L);
if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error)
21315 __pyx_int_136983863 = PyInt_FromLong(136983863L);
if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error)
21316 __pyx_int_184977713 = PyInt_FromLong(184977713L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
21317 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21323 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
21324 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
21325 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
21326 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
21327 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
21328 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
21329 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
21331 static int __Pyx_modinit_global_init_code(
void) {
21332 __Pyx_RefNannyDeclarations
21333 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
21335 generic = Py_None; Py_INCREF(Py_None);
21336 strided = Py_None; Py_INCREF(Py_None);
21337 indirect = Py_None; Py_INCREF(Py_None);
21338 contiguous = Py_None; Py_INCREF(Py_None);
21339 indirect_contiguous = Py_None; Py_INCREF(Py_None);
21340 __Pyx_RefNannyFinishContext();
21344 static int __Pyx_modinit_variable_export_code(
void) {
21345 __Pyx_RefNannyDeclarations
21346 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
21348 __Pyx_RefNannyFinishContext();
21352 static int __Pyx_modinit_function_export_code(
void) {
21353 __Pyx_RefNannyDeclarations
21354 int __pyx_lineno = 0;
21355 const char *__pyx_filename = NULL;
21356 int __pyx_clineno = 0;
21357 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
21359 if (__Pyx_ExportFunction(
"pyc_trace_estimator", (
void (*)(
void))__pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator,
"__pyx_t_5imate_12_definitions_5types_FlagType (struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, PyObject *, struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21360 __Pyx_RefNannyFinishContext();
21363 __Pyx_RefNannyFinishContext();
21367 static int __Pyx_modinit_type_init_code(
void) {
21368 __Pyx_RefNannyDeclarations
21369 int __pyx_lineno = 0;
21370 const char *__pyx_filename = NULL;
21371 int __pyx_clineno = 0;
21372 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
21374 __pyx_vtabptr_array = &__pyx_vtable_array;
21375 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
21376 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
21377 #if PY_VERSION_HEX < 0x030800B1
21378 __pyx_type___pyx_array.tp_print = 0;
21380 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
21381 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
21382 __pyx_array_type = &__pyx_type___pyx_array;
21383 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error)
21384 #if PY_VERSION_HEX < 0x030800B1
21385 __pyx_type___pyx_MemviewEnum.tp_print = 0;
21387 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
21388 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21390 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error)
21391 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
21392 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
21393 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
21394 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
21395 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
21396 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
21397 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
21398 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
21399 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
21400 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
21401 #if PY_VERSION_HEX < 0x030800B1
21402 __pyx_type___pyx_memoryview.tp_print = 0;
21404 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
21405 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21407 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
21408 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
21409 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
21410 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
21411 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
21412 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
21413 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
21414 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
21415 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
21416 #if PY_VERSION_HEX < 0x030800B1
21417 __pyx_type___pyx_memoryviewslice.tp_print = 0;
21419 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
21420 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21422 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
21423 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
21424 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
21425 __Pyx_RefNannyFinishContext();
21428 __Pyx_RefNannyFinishContext();
21432 static int __Pyx_modinit_type_import_code(
void) {
21433 __Pyx_RefNannyDeclarations
21434 PyObject *__pyx_t_1 = NULL;
21435 int __pyx_lineno = 0;
21436 const char *__pyx_filename = NULL;
21437 int __pyx_clineno = 0;
21438 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
21440 __pyx_t_1 = PyImport_ImportModule(
"imate.functions.py_functions");
if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 20, __pyx_L1_error)
21441 __Pyx_GOTREF(__pyx_t_1);
21442 __pyx_ptype_5imate_9functions_12py_functions_pyFunction = __Pyx_ImportType_0_29_36(__pyx_t_1,
"imate.functions.py_functions",
"pyFunction",
sizeof(
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction), __PYX_GET_STRUCT_ALIGNMENT_0_29_36(
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction),__Pyx_ImportType_CheckSize_Warn_0_29_36);
if (!__pyx_ptype_5imate_9functions_12py_functions_pyFunction) __PYX_ERR(3, 20, __pyx_L1_error)
21443 __pyx_vtabptr_5imate_9functions_12py_functions_pyFunction = (
struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction*)__Pyx_GetVtable(__pyx_ptype_5imate_9functions_12py_functions_pyFunction->tp_dict);
if (unlikely(!__pyx_vtabptr_5imate_9functions_12py_functions_pyFunction)) __PYX_ERR(3, 20, __pyx_L1_error)
21444 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21445 __pyx_t_1 = PyImport_ImportModule(
"imate._c_linear_operator.py_c_linear_operator");
if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23, __pyx_L1_error)
21446 __Pyx_GOTREF(__pyx_t_1);
21447 __pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator = __Pyx_ImportType_0_29_36(__pyx_t_1,
"imate._c_linear_operator.py_c_linear_operator",
"pycLinearOperator",
sizeof(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator), __PYX_GET_STRUCT_ALIGNMENT_0_29_36(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator),__Pyx_ImportType_CheckSize_Warn_0_29_36);
if (!__pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator) __PYX_ERR(4, 23, __pyx_L1_error)
21448 __pyx_vtabptr_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator = (
struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator*)__Pyx_GetVtable(__pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator->tp_dict);
if (unlikely(!__pyx_vtabptr_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator)) __PYX_ERR(4, 23, __pyx_L1_error)
21449 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21450 __pyx_t_1 = PyImport_ImportModule(
"imate._c_linear_operator.py_c_matrix");
if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 21, __pyx_L1_error)
21451 __Pyx_GOTREF(__pyx_t_1);
21452 __pyx_ptype_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix = __Pyx_ImportType_0_29_36(__pyx_t_1,
"imate._c_linear_operator.py_c_matrix",
"pycMatrix",
sizeof(
struct __pyx_obj_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix), __PYX_GET_STRUCT_ALIGNMENT_0_29_36(
struct __pyx_obj_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix),__Pyx_ImportType_CheckSize_Warn_0_29_36);
if (!__pyx_ptype_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix) __PYX_ERR(5, 21, __pyx_L1_error)
21453 __pyx_vtabptr_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix = (
struct __pyx_vtabstruct_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix*)__Pyx_GetVtable(__pyx_ptype_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix->tp_dict);
if (unlikely(!__pyx_vtabptr_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix)) __PYX_ERR(5, 21, __pyx_L1_error)
21454 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21455 __pyx_t_1 = PyImport_ImportModule(
"imate._c_linear_operator.py_c_affine_matrix_function");
if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 21, __pyx_L1_error)
21456 __Pyx_GOTREF(__pyx_t_1);
21457 __pyx_ptype_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction = __Pyx_ImportType_0_29_36(__pyx_t_1,
"imate._c_linear_operator.py_c_affine_matrix_function",
"pycAffineMatrixFunction",
sizeof(
struct __pyx_obj_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction), __PYX_GET_STRUCT_ALIGNMENT_0_29_36(
struct __pyx_obj_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction),__Pyx_ImportType_CheckSize_Warn_0_29_36);
if (!__pyx_ptype_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction) __PYX_ERR(6, 21, __pyx_L1_error)
21458 __pyx_vtabptr_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction = (
struct __pyx_vtabstruct_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction*)__Pyx_GetVtable(__pyx_ptype_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction->tp_dict);
if (unlikely(!__pyx_vtabptr_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction)) __PYX_ERR(6, 21, __pyx_L1_error)
21459 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21460 __Pyx_RefNannyFinishContext();
21463 __Pyx_XDECREF(__pyx_t_1);
21464 __Pyx_RefNannyFinishContext();
21468 static int __Pyx_modinit_variable_import_code(
void) {
21469 __Pyx_RefNannyDeclarations
21470 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
21472 __Pyx_RefNannyFinishContext();
21476 static int __Pyx_modinit_function_import_code(
void) {
21477 __Pyx_RefNannyDeclarations
21478 PyObject *__pyx_t_1 = NULL;
21479 int __pyx_lineno = 0;
21480 const char *__pyx_filename = NULL;
21481 int __pyx_clineno = 0;
21482 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
21484 __pyx_t_1 = PyImport_ImportModule(
"scipy.linalg.cython_lapack");
if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
21485 __Pyx_GOTREF(__pyx_t_1);
21486 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"dbdsdc", (
void (**)(
void))&__pyx_f_5scipy_6linalg_13cython_lapack_dbdsdc,
"void (char *, char *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21487 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"dstev", (
void (**)(
void))&__pyx_f_5scipy_6linalg_13cython_lapack_dstev,
"void (char *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21488 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"sbdsdc", (
void (**)(
void))&__pyx_f_5scipy_6linalg_13cython_lapack_sbdsdc,
"void (char *, char *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21489 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"sstev", (
void (**)(
void))&__pyx_f_5scipy_6linalg_13cython_lapack_sstev,
"void (char *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21490 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21491 __Pyx_RefNannyFinishContext();
21494 __Pyx_XDECREF(__pyx_t_1);
21495 __Pyx_RefNannyFinishContext();
21500 #ifndef CYTHON_NO_PYINIT_EXPORT
21501 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21502 #elif PY_MAJOR_VERSION < 3
21504 #define __Pyx_PyMODINIT_FUNC extern "C" void
21506 #define __Pyx_PyMODINIT_FUNC void
21510 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
21512 #define __Pyx_PyMODINIT_FUNC PyObject *
21517 #if PY_MAJOR_VERSION < 3
21521 __Pyx_PyMODINIT_FUNC PyInit_py_c_trace_estimator(
void) CYTHON_SMALL_CODE;
21522 __Pyx_PyMODINIT_FUNC PyInit_py_c_trace_estimator(
void)
21523 #if CYTHON_PEP489_MULTI_PHASE_INIT
21525 return PyModuleDef_Init(&__pyx_moduledef);
21527 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
21528 #if PY_VERSION_HEX >= 0x030700A1
21529 static PY_INT64_T main_interpreter_id = -1;
21530 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
21531 if (main_interpreter_id == -1) {
21532 main_interpreter_id = current_id;
21533 return (unlikely(current_id == -1)) ? -1 : 0;
21534 }
else if (unlikely(main_interpreter_id != current_id))
21536 static PyInterpreterState *main_interpreter = NULL;
21537 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
21538 if (!main_interpreter) {
21539 main_interpreter = current_interpreter;
21540 }
else if (unlikely(main_interpreter != current_interpreter))
21545 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
21550 static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none) {
21551 PyObject *value = PyObject_GetAttrString(spec, from_name);
21553 if (likely(value)) {
21554 if (allow_none || value != Py_None) {
21555 result = PyDict_SetItemString(moddict, to_name, value);
21558 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
21565 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
21566 PyObject *module = NULL, *moddict, *modname;
21567 if (__Pyx_check_single_interpreter())
21570 return __Pyx_NewRef(__pyx_m);
21571 modname = PyObject_GetAttrString(spec,
"name");
21572 if (unlikely(!modname))
goto bad;
21573 module = PyModule_NewObject(modname);
21574 Py_DECREF(modname);
21575 if (unlikely(!module))
goto bad;
21576 moddict = PyModule_GetDict(module);
21577 if (unlikely(!moddict))
goto bad;
21578 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
21579 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
21580 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
21581 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
21584 Py_XDECREF(module);
21589 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_py_c_trace_estimator(PyObject *__pyx_pyinit_module)
21593 __Pyx_TraceDeclarations
21594 PyObject *__pyx_t_1 = NULL;
21595 static PyThread_type_lock __pyx_t_2[8];
21596 int __pyx_lineno = 0;
21597 const char *__pyx_filename = NULL;
21598 int __pyx_clineno = 0;
21599 __Pyx_RefNannyDeclarations
21600 #if CYTHON_PEP489_MULTI_PHASE_INIT
21602 if (__pyx_m == __pyx_pyinit_module)
return 0;
21603 PyErr_SetString(PyExc_RuntimeError,
"Module 'py_c_trace_estimator' has already been imported. Re-initialisation is not supported.");
21606 #elif PY_MAJOR_VERSION >= 3
21607 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
21609 #if CYTHON_REFNANNY
21610 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
21611 if (!__Pyx_RefNanny) {
21613 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
21614 if (!__Pyx_RefNanny)
21615 Py_FatalError(
"failed to import 'refnanny' module");
21618 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_py_c_trace_estimator(void)", 0);
21619 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21620 #ifdef __Pxy_PyFrame_Initialize_Offsets
21621 __Pxy_PyFrame_Initialize_Offsets();
21623 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
21624 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
21625 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
21626 #ifdef __Pyx_CyFunction_USED
21627 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21629 #ifdef __Pyx_FusedFunction_USED
21630 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21632 #ifdef __Pyx_Coroutine_USED
21633 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21635 #ifdef __Pyx_Generator_USED
21636 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21638 #ifdef __Pyx_AsyncGen_USED
21639 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21641 #ifdef __Pyx_StopAsyncIteration_USED
21642 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21646 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
21647 PyEval_InitThreads();
21650 #if CYTHON_PEP489_MULTI_PHASE_INIT
21651 __pyx_m = __pyx_pyinit_module;
21652 Py_INCREF(__pyx_m);
21654 #if PY_MAJOR_VERSION < 3
21655 __pyx_m = Py_InitModule4(
"py_c_trace_estimator", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
21657 __pyx_m = PyModule_Create(&__pyx_moduledef);
21659 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
21661 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
21662 Py_INCREF(__pyx_d);
21663 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
21664 Py_INCREF(__pyx_b);
21665 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
21666 Py_INCREF(__pyx_cython_runtime);
21667 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21669 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21670 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
21671 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21673 if (__pyx_module_is_main_imate___c_trace_estimator__py_c_trace_estimator) {
21674 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21676 #if PY_MAJOR_VERSION >= 3
21678 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
21679 if (!PyDict_GetItemString(modules,
"imate._c_trace_estimator.py_c_trace_estimator")) {
21680 if (unlikely(PyDict_SetItemString(modules,
"imate._c_trace_estimator.py_c_trace_estimator", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21685 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21687 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21689 (void)__Pyx_modinit_global_init_code();
21690 (void)__Pyx_modinit_variable_export_code();
21691 if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21692 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21693 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21694 (void)__Pyx_modinit_variable_import_code();
21695 if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21697 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
21698 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21700 __Pyx_TraceCall(
"__Pyx_PyMODINIT_FUNC PyInit_py_c_trace_estimator(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
21709 __Pyx_TraceLine(15,0,__PYX_ERR(0, 15, __pyx_L1_error))
21710 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
21711 __Pyx_GOTREF(__pyx_t_1);
21712 if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
21713 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21722 __Pyx_TraceLine(21,0,__PYX_ERR(1, 21, __pyx_L1_error))
21732 __Pyx_TraceLine(41,0,__PYX_ERR(1, 41, __pyx_L1_error))
21742 __Pyx_TraceLine(62,0,__PYX_ERR(1, 62, __pyx_L1_error))
21752 __Pyx_TraceLine(84,0,__PYX_ERR(1, 84, __pyx_L1_error))
21762 __Pyx_TraceLine(39,0,__PYX_ERR(0, 39, __pyx_L1_error))
21764 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator, 0, __pyx_n_s_pyc_trace_estimator, NULL, __pyx_n_s_imate__c_trace_estimator_py_c_tr_2, __pyx_d, ((PyObject *)__pyx_codeobj_));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
21765 __Pyx_GOTREF(__pyx_t_1);
21766 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyc_trace_estimator, __pyx_t_1) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
21767 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21776 __Pyx_TraceLine(173,0,__PYX_ERR(0, 173, __pyx_L1_error))
21786 __Pyx_TraceLine(290,0,__PYX_ERR(0, 290, __pyx_L1_error))
21796 __Pyx_TraceLine(407,0,__PYX_ERR(0, 407, __pyx_L1_error))
21804 __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
21805 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21806 __Pyx_GOTREF(__pyx_t_1);
21807 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21808 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21817 __Pyx_TraceLine(210,0,__PYX_ERR(2, 210, __pyx_L1_error))
21818 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_array_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 210, __pyx_L1_error)
21819 __Pyx_GOTREF(__pyx_t_1);
21820 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 210, __pyx_L1_error)
21821 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21822 PyType_Modified(__pyx_array_type);
21831 __Pyx_TraceLine(227,0,__PYX_ERR(2, 227, __pyx_L1_error))
21841 __Pyx_TraceLine(245,0,__PYX_ERR(2, 245, __pyx_L1_error))
21851 __Pyx_TraceLine(287,0,__PYX_ERR(2, 287, __pyx_L1_error))
21852 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
21853 __Pyx_GOTREF(__pyx_t_1);
21854 __Pyx_XGOTREF(
generic);
21855 __Pyx_DECREF_SET(
generic, __pyx_t_1);
21856 __Pyx_GIVEREF(__pyx_t_1);
21866 __Pyx_TraceLine(288,0,__PYX_ERR(2, 288, __pyx_L1_error))
21867 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
21868 __Pyx_GOTREF(__pyx_t_1);
21869 __Pyx_XGOTREF(strided);
21870 __Pyx_DECREF_SET(strided, __pyx_t_1);
21871 __Pyx_GIVEREF(__pyx_t_1);
21881 __Pyx_TraceLine(289,0,__PYX_ERR(2, 289, __pyx_L1_error))
21882 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error)
21883 __Pyx_GOTREF(__pyx_t_1);
21884 __Pyx_XGOTREF(indirect);
21885 __Pyx_DECREF_SET(indirect, __pyx_t_1);
21886 __Pyx_GIVEREF(__pyx_t_1);
21896 __Pyx_TraceLine(292,0,__PYX_ERR(2, 292, __pyx_L1_error))
21897 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
21898 __Pyx_GOTREF(__pyx_t_1);
21899 __Pyx_XGOTREF(contiguous);
21900 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
21901 __Pyx_GIVEREF(__pyx_t_1);
21911 __Pyx_TraceLine(293,0,__PYX_ERR(2, 293, __pyx_L1_error))
21912 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error)
21913 __Pyx_GOTREF(__pyx_t_1);
21914 __Pyx_XGOTREF(indirect_contiguous);
21915 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
21916 __Pyx_GIVEREF(__pyx_t_1);
21926 __Pyx_TraceLine(299,0,__PYX_ERR(2, 299, __pyx_L1_error))
21936 __Pyx_TraceLine(317,0,__PYX_ERR(2, 317, __pyx_L1_error))
21937 __pyx_memoryview_thread_locks_used = 0;
21946 __Pyx_TraceLine(318,0,__PYX_ERR(2, 318, __pyx_L1_error))
21947 __pyx_t_2[0] = PyThread_allocate_lock();
21948 __pyx_t_2[1] = PyThread_allocate_lock();
21949 __pyx_t_2[2] = PyThread_allocate_lock();
21950 __pyx_t_2[3] = PyThread_allocate_lock();
21951 __pyx_t_2[4] = PyThread_allocate_lock();
21952 __pyx_t_2[5] = PyThread_allocate_lock();
21953 __pyx_t_2[6] = PyThread_allocate_lock();
21954 __pyx_t_2[7] = PyThread_allocate_lock();
21955 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
21964 __Pyx_TraceLine(395,0,__PYX_ERR(2, 395, __pyx_L1_error))
21974 __Pyx_TraceLine(433,0,__PYX_ERR(2, 433, __pyx_L1_error))
21984 __Pyx_TraceLine(443,0,__PYX_ERR(2, 443, __pyx_L1_error))
21994 __Pyx_TraceLine(451,0,__PYX_ERR(2, 451, __pyx_L1_error))
22004 __Pyx_TraceLine(483,0,__PYX_ERR(2, 483, __pyx_L1_error))
22014 __Pyx_TraceLine(487,0,__PYX_ERR(2, 487, __pyx_L1_error))
22024 __Pyx_TraceLine(503,0,__PYX_ERR(2, 503, __pyx_L1_error))
22034 __Pyx_TraceLine(551,0,__PYX_ERR(2, 551, __pyx_L1_error))
22035 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error)
22036 __Pyx_GOTREF(__pyx_t_1);
22037 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 551, __pyx_L1_error)
22038 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22039 PyType_Modified(__pyx_memoryview_type);
22048 __Pyx_TraceLine(659,0,__PYX_ERR(2, 659, __pyx_L1_error))
22058 __Pyx_TraceLine(665,0,__PYX_ERR(2, 665, __pyx_L1_error))
22068 __Pyx_TraceLine(668,0,__PYX_ERR(2, 668, __pyx_L1_error))
22078 __Pyx_TraceLine(702,0,__PYX_ERR(2, 702, __pyx_L1_error))
22088 __Pyx_TraceLine(712,0,__PYX_ERR(2, 712, __pyx_L1_error))
22098 __Pyx_TraceLine(809,0,__PYX_ERR(2, 809, __pyx_L1_error))
22108 __Pyx_TraceLine(912,0,__PYX_ERR(2, 912, __pyx_L1_error))
22118 __Pyx_TraceLine(945,0,__PYX_ERR(2, 945, __pyx_L1_error))
22128 __Pyx_TraceLine(981,0,__PYX_ERR(2, 981, __pyx_L1_error))
22138 __Pyx_TraceLine(987,0,__PYX_ERR(2, 987, __pyx_L1_error))
22148 __Pyx_TraceLine(997,0,__PYX_ERR(2, 997, __pyx_L1_error))
22149 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error)
22150 __Pyx_GOTREF(__pyx_t_1);
22151 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 997, __pyx_L1_error)
22152 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22153 PyType_Modified(__pyx_memoryviewslice_type);
22162 __Pyx_TraceLine(1001,0,__PYX_ERR(2, 1001, __pyx_L1_error))
22172 __Pyx_TraceLine(1054,0,__PYX_ERR(2, 1054, __pyx_L1_error))
22182 __Pyx_TraceLine(1065,0,__PYX_ERR(2, 1065, __pyx_L1_error))
22192 __Pyx_TraceLine(1082,0,__PYX_ERR(2, 1082, __pyx_L1_error))
22202 __Pyx_TraceLine(1089,0,__PYX_ERR(2, 1089, __pyx_L1_error))
22212 __Pyx_TraceLine(1111,0,__PYX_ERR(2, 1111, __pyx_L1_error))
22222 __Pyx_TraceLine(1118,0,__PYX_ERR(2, 1118, __pyx_L1_error))
22232 __Pyx_TraceLine(1172,0,__PYX_ERR(2, 1172, __pyx_L1_error))
22242 __Pyx_TraceLine(1179,0,__PYX_ERR(2, 1179, __pyx_L1_error))
22252 __Pyx_TraceLine(1189,0,__PYX_ERR(2, 1189, __pyx_L1_error))
22262 __Pyx_TraceLine(1210,0,__PYX_ERR(2, 1210, __pyx_L1_error))
22272 __Pyx_TraceLine(1253,0,__PYX_ERR(2, 1253, __pyx_L1_error))
22282 __Pyx_TraceLine(1259,0,__PYX_ERR(2, 1259, __pyx_L1_error))
22292 __Pyx_TraceLine(1263,0,__PYX_ERR(2, 1263, __pyx_L1_error))
22302 __Pyx_TraceLine(1270,0,__PYX_ERR(2, 1270, __pyx_L1_error))
22312 __Pyx_TraceLine(1342,0,__PYX_ERR(2, 1342, __pyx_L1_error))
22322 __Pyx_TraceLine(1364,0,__PYX_ERR(2, 1364, __pyx_L1_error))
22332 __Pyx_TraceLine(1373,0,__PYX_ERR(2, 1373, __pyx_L1_error))
22342 __Pyx_TraceLine(1379,0,__PYX_ERR(2, 1379, __pyx_L1_error))
22352 __Pyx_TraceLine(1399,0,__PYX_ERR(2, 1399, __pyx_L1_error))
22362 __Pyx_TraceLine(1409,0,__PYX_ERR(2, 1409, __pyx_L1_error))
22370 __Pyx_TraceLine(1,0,__PYX_ERR(2, 1, __pyx_L1_error))
22371 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
22372 __Pyx_GOTREF(__pyx_t_1);
22373 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
22374 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22383 __Pyx_TraceLine(11,0,__PYX_ERR(2, 11, __pyx_L1_error))
22385 __Pyx_TraceReturn(Py_None, 0);
22391 __Pyx_XDECREF(__pyx_t_1);
22394 __Pyx_AddTraceback(
"init imate._c_trace_estimator.py_c_trace_estimator", __pyx_clineno, __pyx_lineno, __pyx_filename);
22397 }
else if (!PyErr_Occurred()) {
22398 PyErr_SetString(PyExc_ImportError,
"init imate._c_trace_estimator.py_c_trace_estimator");
22401 __Pyx_RefNannyFinishContext();
22402 #if CYTHON_PEP489_MULTI_PHASE_INIT
22403 return (__pyx_m != NULL) ? 0 : -1;
22404 #elif PY_MAJOR_VERSION >= 3
22413 #if CYTHON_REFNANNY
22414 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
22415 PyObject *m = NULL, *p = NULL;
22417 m = PyImport_ImportModule(modname);
22419 p = PyObject_GetAttrString(m,
"RefNannyAPI");
22421 r = PyLong_AsVoidPtr(p);
22425 return (__Pyx_RefNannyAPIStruct *)r;
22430 #if CYTHON_USE_TYPE_SLOTS
22431 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
22432 PyTypeObject* tp = Py_TYPE(obj);
22433 if (likely(tp->tp_getattro))
22434 return tp->tp_getattro(obj, attr_name);
22435 #if PY_MAJOR_VERSION < 3
22436 if (likely(tp->tp_getattr))
22437 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
22439 return PyObject_GetAttr(obj, attr_name);
22444 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
22445 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
22446 if (unlikely(!result)) {
22447 PyErr_Format(PyExc_NameError,
22448 #
if PY_MAJOR_VERSION >= 3
22449 "name '%U' is not defined", name);
22451 "name '%.200s' is not defined", PyString_AS_STRING(name));
22458 #if CYTHON_FAST_THREAD_STATE
22459 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22460 PyObject *tmp_type, *tmp_value, *tmp_tb;
22461 tmp_type = tstate->curexc_type;
22462 tmp_value = tstate->curexc_value;
22463 tmp_tb = tstate->curexc_traceback;
22464 tstate->curexc_type = type;
22465 tstate->curexc_value = value;
22466 tstate->curexc_traceback = tb;
22467 Py_XDECREF(tmp_type);
22468 Py_XDECREF(tmp_value);
22469 Py_XDECREF(tmp_tb);
22471 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22472 *type = tstate->curexc_type;
22473 *value = tstate->curexc_value;
22474 *tb = tstate->curexc_traceback;
22475 tstate->curexc_type = 0;
22476 tstate->curexc_value = 0;
22477 tstate->curexc_traceback = 0;
22483 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
22484 PyFrameObject** frame,
22485 PyThreadState* tstate,
22486 const char *funcname,
22487 const char *srcfile,
22489 PyObject *type, *value, *traceback;
22491 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
22492 if (*code == NULL) {
22493 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
22494 if (*code == NULL)
return 0;
22496 *frame = PyFrame_New(
22502 if (*frame == NULL)
return 0;
22503 if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
22504 Py_INCREF(Py_None);
22505 (*frame)->f_trace = Py_None;
22507 #if PY_VERSION_HEX < 0x030400B1
22509 (*frame)->f_tstate = tstate;
22512 __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
22514 __Pyx_EnterTracing(tstate);
22515 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
22517 if (tstate->c_tracefunc)
22518 retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
22519 if (retval && tstate->c_profilefunc)
22521 retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
22522 __Pyx_LeaveTracing(tstate);
22524 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
22525 return __Pyx_IsTracing(tstate, 0, 0) && retval;
22529 Py_XDECREF(traceback);
22533 static PyCodeObject *__Pyx_createFrameCodeObject(
const char *funcname,
const char *srcfile,
int firstlineno) {
22534 PyCodeObject *py_code = 0;
22535 #if PY_MAJOR_VERSION >= 3
22536 py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
22537 if (likely(py_code)) {
22538 py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
22541 PyObject *py_srcfile = 0;
22542 PyObject *py_funcname = 0;
22543 py_funcname = PyString_FromString(funcname);
22544 if (unlikely(!py_funcname))
goto bad;
22545 py_srcfile = PyString_FromString(srcfile);
22546 if (unlikely(!py_srcfile))
goto bad;
22547 py_code = PyCode_New(
22551 CO_OPTIMIZED | CO_NEWLOCALS,
22564 Py_XDECREF(py_srcfile);
22565 Py_XDECREF(py_funcname);
22572 static void __Pyx_WriteUnraisable(
const char *name, CYTHON_UNUSED
int clineno,
22573 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
22574 int full_traceback, CYTHON_UNUSED
int nogil) {
22575 PyObject *old_exc, *old_val, *old_tb;
22577 __Pyx_PyThreadState_declare
22579 PyGILState_STATE state;
22581 state = PyGILState_Ensure();
22582 else state = (PyGILState_STATE)0;
22584 __Pyx_PyThreadState_assign
22585 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
22586 if (full_traceback) {
22587 Py_XINCREF(old_exc);
22588 Py_XINCREF(old_val);
22589 Py_XINCREF(old_tb);
22590 __Pyx_ErrRestore(old_exc, old_val, old_tb);
22593 #if PY_MAJOR_VERSION < 3
22594 ctx = PyString_FromString(name);
22596 ctx = PyUnicode_FromString(name);
22598 __Pyx_ErrRestore(old_exc, old_val, old_tb);
22600 PyErr_WriteUnraisable(Py_None);
22602 PyErr_WriteUnraisable(ctx);
22607 PyGILState_Release(state);
22612 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
22613 #if CYTHON_COMPILING_IN_PYPY
22614 return PyObject_RichCompareBool(s1, s2, equals);
22617 return (equals == Py_EQ);
22618 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
22619 const char *ps1, *ps2;
22620 Py_ssize_t length = PyBytes_GET_SIZE(s1);
22621 if (length != PyBytes_GET_SIZE(s2))
22622 return (equals == Py_NE);
22623 ps1 = PyBytes_AS_STRING(s1);
22624 ps2 = PyBytes_AS_STRING(s2);
22625 if (ps1[0] != ps2[0]) {
22626 return (equals == Py_NE);
22627 }
else if (length == 1) {
22628 return (equals == Py_EQ);
22631 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
22632 Py_hash_t hash1, hash2;
22633 hash1 = ((PyBytesObject*)s1)->ob_shash;
22634 hash2 = ((PyBytesObject*)s2)->ob_shash;
22635 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22636 return (equals == Py_NE);
22639 result = memcmp(ps1, ps2, (
size_t)length);
22640 return (equals == Py_EQ) ? (result == 0) : (result != 0);
22642 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
22643 return (equals == Py_NE);
22644 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
22645 return (equals == Py_NE);
22648 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22651 result = __Pyx_PyObject_IsTrue(py_result);
22652 Py_DECREF(py_result);
22660 __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
22662 __Pyx_memviewslice *memviewslice,
22663 int memview_is_new_reference)
22665 __Pyx_RefNannyDeclarations
22667 Py_buffer *buf = &memview->view;
22668 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
22669 if (unlikely(memviewslice->memview || memviewslice->data)) {
22670 PyErr_SetString(PyExc_ValueError,
22671 "memviewslice is already initialized!");
22674 if (buf->strides) {
22675 for (i = 0; i < ndim; i++) {
22676 memviewslice->strides[i] = buf->strides[i];
22679 Py_ssize_t stride = buf->itemsize;
22680 for (i = ndim - 1; i >= 0; i--) {
22681 memviewslice->strides[i] = stride;
22682 stride *= buf->shape[i];
22685 for (i = 0; i < ndim; i++) {
22686 memviewslice->shape[i] = buf->shape[i];
22687 if (buf->suboffsets) {
22688 memviewslice->suboffsets[i] = buf->suboffsets[i];
22690 memviewslice->suboffsets[i] = -1;
22693 memviewslice->memview = memview;
22694 memviewslice->data = (
char *)buf->buf;
22695 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
22696 Py_INCREF(memview);
22701 memviewslice->memview = 0;
22702 memviewslice->data = 0;
22705 __Pyx_RefNannyFinishContext();
22708 #ifndef Py_NO_RETURN
22709 #define Py_NO_RETURN
22711 static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
22714 #if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES)
22715 va_start(vargs, fmt);
22719 vsnprintf(msg, 200, fmt, vargs);
22721 Py_FatalError(msg);
22723 static CYTHON_INLINE
int
22724 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22725 PyThread_type_lock lock)
22728 PyThread_acquire_lock(lock, 1);
22729 result = (*acquisition_count)++;
22730 PyThread_release_lock(lock);
22733 static CYTHON_INLINE
int
22734 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22735 PyThread_type_lock lock)
22738 PyThread_acquire_lock(lock, 1);
22739 result = (*acquisition_count)--;
22740 PyThread_release_lock(lock);
22743 static CYTHON_INLINE
void
22744 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
22747 struct __pyx_memoryview_obj *memview = memslice->memview;
22748 if (unlikely(!memview || (PyObject *) memview == Py_None))
22750 if (unlikely(__pyx_get_slice_count(memview) < 0))
22751 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
22752 __pyx_get_slice_count(memview), lineno);
22753 first_time = __pyx_add_acquisition_count(memview) == 0;
22754 if (unlikely(first_time)) {
22756 Py_INCREF((PyObject *) memview);
22758 PyGILState_STATE _gilstate = PyGILState_Ensure();
22759 Py_INCREF((PyObject *) memview);
22760 PyGILState_Release(_gilstate);
22764 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
22765 int have_gil,
int lineno) {
22767 struct __pyx_memoryview_obj *memview = memslice->memview;
22768 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
22769 memslice->memview = NULL;
22772 if (unlikely(__pyx_get_slice_count(memview) <= 0))
22773 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
22774 __pyx_get_slice_count(memview), lineno);
22775 last_time = __pyx_sub_acquisition_count(memview) == 1;
22776 memslice->data = NULL;
22777 if (unlikely(last_time)) {
22779 Py_CLEAR(memslice->memview);
22781 PyGILState_STATE _gilstate = PyGILState_Ensure();
22782 Py_CLEAR(memslice->memview);
22783 PyGILState_Release(_gilstate);
22786 memslice->memview = NULL;
22791 #if CYTHON_COMPILING_IN_CPYTHON
22792 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
22794 ternaryfunc call = Py_TYPE(func)->tp_call;
22795 if (unlikely(!call))
22796 return PyObject_Call(func, arg, kw);
22797 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
22799 result = (*call)(func, arg, kw);
22800 Py_LeaveRecursiveCall();
22801 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22804 "NULL result without error in PyObject_Call");
22811 #if PY_MAJOR_VERSION < 3
22812 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
22813 CYTHON_UNUSED PyObject *cause) {
22814 __Pyx_PyThreadState_declare
22816 if (!value || value == Py_None)
22820 if (!tb || tb == Py_None)
22824 if (!PyTraceBack_Check(tb)) {
22825 PyErr_SetString(PyExc_TypeError,
22826 "raise: arg 3 must be a traceback or None");
22830 if (PyType_Check(type)) {
22831 #if CYTHON_COMPILING_IN_PYPY
22833 Py_INCREF(Py_None);
22837 PyErr_NormalizeException(&type, &value, &tb);
22840 PyErr_SetString(PyExc_TypeError,
22841 "instance exception may not have a separate value");
22845 type = (PyObject*) Py_TYPE(type);
22847 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
22848 PyErr_SetString(PyExc_TypeError,
22849 "raise: exception class must be a subclass of BaseException");
22853 __Pyx_PyThreadState_assign
22854 __Pyx_ErrRestore(type, value, tb);
22863 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
22864 PyObject* owned_instance = NULL;
22865 if (tb == Py_None) {
22867 }
else if (tb && !PyTraceBack_Check(tb)) {
22868 PyErr_SetString(PyExc_TypeError,
22869 "raise: arg 3 must be a traceback or None");
22872 if (value == Py_None)
22874 if (PyExceptionInstance_Check(type)) {
22876 PyErr_SetString(PyExc_TypeError,
22877 "instance exception may not have a separate value");
22881 type = (PyObject*) Py_TYPE(value);
22882 }
else if (PyExceptionClass_Check(type)) {
22883 PyObject *instance_class = NULL;
22884 if (value && PyExceptionInstance_Check(value)) {
22885 instance_class = (PyObject*) Py_TYPE(value);
22886 if (instance_class != type) {
22887 int is_subclass = PyObject_IsSubclass(instance_class, type);
22888 if (!is_subclass) {
22889 instance_class = NULL;
22890 }
else if (unlikely(is_subclass == -1)) {
22893 type = instance_class;
22897 if (!instance_class) {
22900 args = PyTuple_New(0);
22901 else if (PyTuple_Check(value)) {
22905 args = PyTuple_Pack(1, value);
22908 owned_instance = PyObject_Call(type, args, NULL);
22910 if (!owned_instance)
22912 value = owned_instance;
22913 if (!PyExceptionInstance_Check(value)) {
22914 PyErr_Format(PyExc_TypeError,
22915 "calling %R should have returned an instance of "
22916 "BaseException, not %R",
22917 type, Py_TYPE(value));
22922 PyErr_SetString(PyExc_TypeError,
22923 "raise: exception class must be a subclass of BaseException");
22927 PyObject *fixed_cause;
22928 if (cause == Py_None) {
22929 fixed_cause = NULL;
22930 }
else if (PyExceptionClass_Check(cause)) {
22931 fixed_cause = PyObject_CallObject(cause, NULL);
22932 if (fixed_cause == NULL)
22934 }
else if (PyExceptionInstance_Check(cause)) {
22935 fixed_cause = cause;
22936 Py_INCREF(fixed_cause);
22938 PyErr_SetString(PyExc_TypeError,
22939 "exception causes must derive from "
22943 PyException_SetCause(value, fixed_cause);
22945 PyErr_SetObject(type, value);
22947 #if CYTHON_FAST_THREAD_STATE
22948 PyThreadState *tstate = __Pyx_PyThreadState_Current;
22949 PyObject* tmp_tb = tstate->curexc_traceback;
22950 if (tb != tmp_tb) {
22952 tstate->curexc_traceback = tb;
22953 Py_XDECREF(tmp_tb);
22956 PyObject *tmp_type, *tmp_value, *tmp_tb;
22957 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
22959 PyErr_Restore(tmp_type, tmp_value, tb);
22960 Py_XDECREF(tmp_tb);
22964 Py_XDECREF(owned_instance);
22970 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
22973 r = PyObject_SetItem(o, j, v);
22977 static CYTHON_INLINE
int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
int is_list,
22978 CYTHON_NCP_UNUSED
int wraparound, CYTHON_NCP_UNUSED
int boundscheck) {
22979 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
22980 if (is_list || PyList_CheckExact(o)) {
22981 Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
22982 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
22983 PyObject* old = PyList_GET_ITEM(o, n);
22985 PyList_SET_ITEM(o, n, v);
22990 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
22991 if (likely(m && m->sq_ass_item)) {
22992 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
22993 Py_ssize_t l = m->sq_length(o);
22994 if (likely(l >= 0)) {
22997 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23002 return m->sq_ass_item(o, i, v);
23006 #if CYTHON_COMPILING_IN_PYPY
23007 if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
23009 if (is_list || PySequence_Check(o))
23012 return PySequence_SetItem(o, i, v);
23015 return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
23019 static void __Pyx_RaiseArgtupleInvalid(
23020 const char* func_name,
23022 Py_ssize_t num_min,
23023 Py_ssize_t num_max,
23024 Py_ssize_t num_found)
23026 Py_ssize_t num_expected;
23027 const char *more_or_less;
23028 if (num_found < num_min) {
23029 num_expected = num_min;
23030 more_or_less =
"at least";
23032 num_expected = num_max;
23033 more_or_less =
"at most";
23036 more_or_less =
"exactly";
23038 PyErr_Format(PyExc_TypeError,
23039 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
23040 func_name, more_or_less, num_expected,
23041 (num_expected == 1) ?
"" :
"s", num_found);
23045 static void __Pyx_RaiseDoubleKeywordsError(
23046 const char* func_name,
23049 PyErr_Format(PyExc_TypeError,
23050 #
if PY_MAJOR_VERSION >= 3
23051 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23053 "%s() got multiple values for keyword argument '%s'", func_name,
23054 PyString_AsString(kw_name));
23059 static int __Pyx_ParseOptionalKeywords(
23061 PyObject **argnames[],
23063 PyObject *values[],
23064 Py_ssize_t num_pos_args,
23065 const char* function_name)
23067 PyObject *key = 0, *value = 0;
23068 Py_ssize_t pos = 0;
23070 PyObject*** first_kw_arg = argnames + num_pos_args;
23071 while (PyDict_Next(kwds, &pos, &key, &value)) {
23072 name = first_kw_arg;
23073 while (*name && (**name != key)) name++;
23075 values[name-argnames] = value;
23078 name = first_kw_arg;
23079 #if PY_MAJOR_VERSION < 3
23080 if (likely(PyString_Check(key))) {
23082 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23083 && _PyString_Eq(**name, key)) {
23084 values[name-argnames] = value;
23089 if (*name)
continue;
23091 PyObject*** argname = argnames;
23092 while (argname != first_kw_arg) {
23093 if ((**argname == key) || (
23094 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23095 && _PyString_Eq(**argname, key))) {
23096 goto arg_passed_twice;
23103 if (likely(PyUnicode_Check(key))) {
23105 int cmp = (**name == key) ? 0 :
23106 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23107 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23109 PyUnicode_Compare(**name, key);
23110 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23112 values[name-argnames] = value;
23117 if (*name)
continue;
23119 PyObject*** argname = argnames;
23120 while (argname != first_kw_arg) {
23121 int cmp = (**argname == key) ? 0 :
23122 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23123 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23125 PyUnicode_Compare(**argname, key);
23126 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23127 if (cmp == 0)
goto arg_passed_twice;
23132 goto invalid_keyword_type;
23134 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
23136 goto invalid_keyword;
23141 __Pyx_RaiseDoubleKeywordsError(function_name, key);
23143 invalid_keyword_type:
23144 PyErr_Format(PyExc_TypeError,
23145 "%.200s() keywords must be strings", function_name);
23148 PyErr_Format(PyExc_TypeError,
23149 #
if PY_MAJOR_VERSION < 3
23150 "%.200s() got an unexpected keyword argument '%.200s'",
23151 function_name, PyString_AsString(key));
23153 "%s() got an unexpected keyword argument '%U'",
23154 function_name, key);
23161 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
23163 if (unlikely(!type)) {
23164 PyErr_SetString(PyExc_SystemError,
"Missing type object");
23168 #if PY_MAJOR_VERSION == 2
23169 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
23173 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
23175 PyErr_Format(PyExc_TypeError,
23176 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
23177 name, type->tp_name, Py_TYPE(obj)->tp_name);
23182 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
23183 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
23184 PyObject *dict = Py_TYPE(obj)->tp_dict;
23185 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
23187 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
23188 PyObject **dictptr = NULL;
23189 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
23191 #if CYTHON_COMPILING_IN_CPYTHON
23192 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
23194 dictptr = _PyObject_GetDictPtr(obj);
23197 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
23199 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
23200 PyObject *dict = Py_TYPE(obj)->tp_dict;
23201 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
23203 return obj_dict_version == __Pyx_get_object_dict_version(obj);
23208 #if CYTHON_USE_DICT_VERSIONS
23209 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
23211 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
23215 #if !CYTHON_AVOID_BORROWED_REFS
23216 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
23217 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
23218 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23219 if (likely(result)) {
23220 return __Pyx_NewRef(result);
23221 }
else if (unlikely(PyErr_Occurred())) {
23225 result = PyDict_GetItem(__pyx_d, name);
23226 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23227 if (likely(result)) {
23228 return __Pyx_NewRef(result);
23232 result = PyObject_GetItem(__pyx_d, name);
23233 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23234 if (likely(result)) {
23235 return __Pyx_NewRef(result);
23239 return __Pyx_GetBuiltinName(name);
23243 #if CYTHON_FAST_PYCCALL
23244 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
23245 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
23246 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
23247 PyObject *
self = PyCFunction_GET_SELF(func);
23248 int flags = PyCFunction_GET_FLAGS(func);
23249 assert(PyCFunction_Check(func));
23250 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
23251 assert(nargs >= 0);
23252 assert(nargs == 0 || args != NULL);
23256 assert(!PyErr_Occurred());
23257 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
23258 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (
self, args, nargs, NULL);
23260 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (
self, args, nargs);
23266 #if CYTHON_FAST_PYCALL
23267 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
23268 PyObject *globals) {
23270 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23271 PyObject **fastlocals;
23274 assert(globals != NULL);
23279 assert(tstate != NULL);
23280 f = PyFrame_New(tstate, co, globals, NULL);
23284 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
23285 for (i = 0; i < na; i++) {
23287 fastlocals[i] = *args++;
23289 result = PyEval_EvalFrameEx(f,0);
23290 ++tstate->recursion_depth;
23292 --tstate->recursion_depth;
23295 #if 1 || PY_VERSION_HEX < 0x030600B1
23296 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
23297 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
23298 PyObject *globals = PyFunction_GET_GLOBALS(func);
23299 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
23301 #if PY_MAJOR_VERSION >= 3
23304 PyObject *kwtuple, **k;
23309 assert(kwargs == NULL || PyDict_Check(kwargs));
23310 nk = kwargs ? PyDict_Size(kwargs) : 0;
23311 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
23315 #
if PY_MAJOR_VERSION >= 3
23316 co->co_kwonlyargcount == 0 &&
23318 likely(kwargs == NULL || nk == 0) &&
23319 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
23320 if (argdefs == NULL && co->co_argcount == nargs) {
23321 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
23324 else if (nargs == 0 && argdefs != NULL
23325 && co->co_argcount == Py_SIZE(argdefs)) {
23328 args = &PyTuple_GET_ITEM(argdefs, 0);
23329 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
23333 if (kwargs != NULL) {
23335 kwtuple = PyTuple_New(2 * nk);
23336 if (kwtuple == NULL) {
23340 k = &PyTuple_GET_ITEM(kwtuple, 0);
23342 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
23353 closure = PyFunction_GET_CLOSURE(func);
23354 #if PY_MAJOR_VERSION >= 3
23355 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
23357 if (argdefs != NULL) {
23358 d = &PyTuple_GET_ITEM(argdefs, 0);
23359 nd = Py_SIZE(argdefs);
23365 #if PY_MAJOR_VERSION >= 3
23366 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
23369 d, (
int)nd, kwdefs, closure);
23371 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
23374 d, (
int)nd, closure);
23376 Py_XDECREF(kwtuple);
23378 Py_LeaveRecursiveCall();
23385 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2) {
23386 PyObject *args, *result = NULL;
23387 #if CYTHON_FAST_PYCALL
23388 if (PyFunction_Check(
function)) {
23389 PyObject *args[2] = {arg1, arg2};
23390 return __Pyx_PyFunction_FastCall(
function, args, 2);
23393 #if CYTHON_FAST_PYCCALL
23394 if (__Pyx_PyFastCFunction_Check(
function)) {
23395 PyObject *args[2] = {arg1, arg2};
23396 return __Pyx_PyCFunction_FastCall(
function, args, 2);
23399 args = PyTuple_New(2);
23400 if (unlikely(!args))
goto done;
23402 PyTuple_SET_ITEM(args, 0, arg1);
23404 PyTuple_SET_ITEM(args, 1, arg2);
23405 Py_INCREF(
function);
23406 result = __Pyx_PyObject_Call(
function, args, NULL);
23408 Py_DECREF(
function);
23414 #if CYTHON_COMPILING_IN_CPYTHON
23415 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
23416 PyObject *
self, *result;
23418 cfunc = PyCFunction_GET_FUNCTION(func);
23419 self = PyCFunction_GET_SELF(func);
23420 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
23422 result = cfunc(
self, arg);
23423 Py_LeaveRecursiveCall();
23424 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23427 "NULL result without error in PyObject_Call");
23434 #if CYTHON_COMPILING_IN_CPYTHON
23435 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23437 PyObject *args = PyTuple_New(1);
23438 if (unlikely(!args))
return NULL;
23440 PyTuple_SET_ITEM(args, 0, arg);
23441 result = __Pyx_PyObject_Call(func, args, NULL);
23445 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23446 #if CYTHON_FAST_PYCALL
23447 if (PyFunction_Check(func)) {
23448 return __Pyx_PyFunction_FastCall(func, &arg, 1);
23451 if (likely(PyCFunction_Check(func))) {
23452 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
23453 return __Pyx_PyObject_CallMethO(func, arg);
23454 #if CYTHON_FAST_PYCCALL
23455 }
else if (__Pyx_PyFastCFunction_Check(func)) {
23456 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
23460 return __Pyx__PyObject_CallOneArg(func, arg);
23463 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23465 PyObject *args = PyTuple_Pack(1, arg);
23466 if (unlikely(!args))
return NULL;
23467 result = __Pyx_PyObject_Call(func, args, NULL);
23474 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
23475 #if CYTHON_COMPILING_IN_PYPY
23476 return PyObject_RichCompareBool(s1, s2, equals);
23478 #if PY_MAJOR_VERSION < 3
23479 PyObject* owned_ref = NULL;
23481 int s1_is_unicode, s2_is_unicode;
23485 s1_is_unicode = PyUnicode_CheckExact(s1);
23486 s2_is_unicode = PyUnicode_CheckExact(s2);
23487 #if PY_MAJOR_VERSION < 3
23488 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
23489 owned_ref = PyUnicode_FromObject(s2);
23490 if (unlikely(!owned_ref))
23494 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
23495 owned_ref = PyUnicode_FromObject(s1);
23496 if (unlikely(!owned_ref))
23500 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
23501 return __Pyx_PyBytes_Equals(s1, s2, equals);
23504 if (s1_is_unicode & s2_is_unicode) {
23507 void *data1, *data2;
23508 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
23510 length = __Pyx_PyUnicode_GET_LENGTH(s1);
23511 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
23514 #if CYTHON_USE_UNICODE_INTERNALS
23516 Py_hash_t hash1, hash2;
23517 #if CYTHON_PEP393_ENABLED
23518 hash1 = ((PyASCIIObject*)s1)->hash;
23519 hash2 = ((PyASCIIObject*)s2)->hash;
23521 hash1 = ((PyUnicodeObject*)s1)->hash;
23522 hash2 = ((PyUnicodeObject*)s2)->hash;
23524 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23529 kind = __Pyx_PyUnicode_KIND(s1);
23530 if (kind != __Pyx_PyUnicode_KIND(s2)) {
23533 data1 = __Pyx_PyUnicode_DATA(s1);
23534 data2 = __Pyx_PyUnicode_DATA(s2);
23535 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
23537 }
else if (length == 1) {
23540 int result = memcmp(data1, data2, (
size_t)(length * kind));
23541 #if PY_MAJOR_VERSION < 3
23542 Py_XDECREF(owned_ref);
23544 return (equals == Py_EQ) ? (result == 0) : (result != 0);
23546 }
else if ((s1 == Py_None) & s2_is_unicode) {
23548 }
else if ((s2 == Py_None) & s1_is_unicode) {
23552 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23553 #if PY_MAJOR_VERSION < 3
23554 Py_XDECREF(owned_ref);
23558 result = __Pyx_PyObject_IsTrue(py_result);
23559 Py_DECREF(py_result);
23563 #if PY_MAJOR_VERSION < 3
23564 Py_XDECREF(owned_ref);
23566 return (equals == Py_EQ);
23568 #if PY_MAJOR_VERSION < 3
23569 Py_XDECREF(owned_ref);
23571 return (equals == Py_NE);
23576 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
23577 #if CYTHON_USE_TYPE_SLOTS
23578 #if PY_MAJOR_VERSION >= 3
23579 if (likely(PyUnicode_Check(n)))
23581 if (likely(PyString_Check(n)))
23583 return __Pyx_PyObject_GetAttrStr(o, n);
23585 return PyObject_GetAttr(o, n);
23589 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
23591 if (!j)
return NULL;
23592 r = PyObject_GetItem(o, j);
23596 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
23597 CYTHON_NCP_UNUSED
int wraparound,
23598 CYTHON_NCP_UNUSED
int boundscheck) {
23599 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23600 Py_ssize_t wrapped_i = i;
23601 if (wraparound & unlikely(i < 0)) {
23602 wrapped_i += PyList_GET_SIZE(o);
23604 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
23605 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
23609 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23611 return PySequence_GetItem(o, i);
23614 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
23615 CYTHON_NCP_UNUSED
int wraparound,
23616 CYTHON_NCP_UNUSED
int boundscheck) {
23617 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23618 Py_ssize_t wrapped_i = i;
23619 if (wraparound & unlikely(i < 0)) {
23620 wrapped_i += PyTuple_GET_SIZE(o);
23622 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
23623 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
23627 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23629 return PySequence_GetItem(o, i);
23632 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
23633 CYTHON_NCP_UNUSED
int wraparound,
23634 CYTHON_NCP_UNUSED
int boundscheck) {
23635 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23636 if (is_list || PyList_CheckExact(o)) {
23637 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
23638 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
23639 PyObject *r = PyList_GET_ITEM(o, n);
23644 else if (PyTuple_CheckExact(o)) {
23645 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
23646 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
23647 PyObject *r = PyTuple_GET_ITEM(o, n);
23652 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23653 if (likely(m && m->sq_item)) {
23654 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23655 Py_ssize_t l = m->sq_length(o);
23656 if (likely(l >= 0)) {
23659 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23664 return m->sq_item(o, i);
23668 if (is_list || PySequence_Check(o)) {
23669 return PySequence_GetItem(o, i);
23672 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23676 #if CYTHON_USE_TYPE_SLOTS
23677 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
23678 PyObject *runerr = NULL;
23679 Py_ssize_t key_value;
23680 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
23681 if (unlikely(!(m && m->sq_item))) {
23682 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
23685 key_value = __Pyx_PyIndex_AsSsize_t(index);
23686 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
23687 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
23689 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
23691 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
23695 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
23696 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
23697 if (likely(m && m->mp_subscript)) {
23698 return m->mp_subscript(obj, key);
23700 return __Pyx_PyObject_GetIndex(obj, key);
23705 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
23706 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
23707 const char* encoding,
const char* errors,
23708 PyObject* (*decode_func)(
const char *s, Py_ssize_t size,
const char *errors)) {
23710 if (unlikely((start < 0) | (stop < 0))) {
23711 size_t slen = strlen(cstring);
23712 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
23713 PyErr_SetString(PyExc_OverflowError,
23714 "c-string too long to convert to Python");
23717 length = (Py_ssize_t) slen;
23726 if (unlikely(stop <= start))
23727 return __Pyx_NewRef(__pyx_empty_unicode);
23728 length = stop - start;
23731 return decode_func(cstring, length, errors);
23733 return PyUnicode_Decode(cstring, length, encoding, errors);
23738 #if CYTHON_FAST_THREAD_STATE
23739 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
23741 n = PyTuple_GET_SIZE(tuple);
23742 #if PY_MAJOR_VERSION >= 3
23743 for (i=0; i<n; i++) {
23744 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
23747 for (i=0; i<n; i++) {
23748 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
23752 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
23753 PyObject *exc_type = tstate->curexc_type;
23754 if (exc_type == err)
return 1;
23755 if (unlikely(!exc_type))
return 0;
23756 if (unlikely(PyTuple_Check(err)))
23757 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
23758 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
23763 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
23764 __Pyx_PyThreadState_declare
23765 __Pyx_PyThreadState_assign
23766 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23768 __Pyx_PyErr_Clear();
23772 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
23773 PyObject *r = __Pyx_GetAttr(o, n);
23774 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
23778 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
23779 PyErr_Format(PyExc_ValueError,
23780 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
23784 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
23785 PyErr_Format(PyExc_ValueError,
23786 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
23787 index, (index == 1) ?
"" :
"s");
23791 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
23792 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
23796 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
23797 if (unlikely(!type)) {
23798 PyErr_SetString(PyExc_SystemError,
"Missing type object");
23801 if (likely(__Pyx_TypeCheck(obj, type)))
23803 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
23804 Py_TYPE(obj)->tp_name, type->tp_name);
23809 #if CYTHON_USE_EXC_INFO_STACK
23810 static _PyErr_StackItem *
23811 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
23813 _PyErr_StackItem *exc_info = tstate->exc_info;
23814 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
23815 exc_info->previous_item != NULL)
23817 exc_info = exc_info->previous_item;
23824 #if CYTHON_FAST_THREAD_STATE
23825 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23826 #if CYTHON_USE_EXC_INFO_STACK
23827 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
23828 *type = exc_info->exc_type;
23829 *value = exc_info->exc_value;
23830 *tb = exc_info->exc_traceback;
23832 *type = tstate->exc_type;
23833 *value = tstate->exc_value;
23834 *tb = tstate->exc_traceback;
23837 Py_XINCREF(*value);
23840 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23841 PyObject *tmp_type, *tmp_value, *tmp_tb;
23842 #if CYTHON_USE_EXC_INFO_STACK
23843 _PyErr_StackItem *exc_info = tstate->exc_info;
23844 tmp_type = exc_info->exc_type;
23845 tmp_value = exc_info->exc_value;
23846 tmp_tb = exc_info->exc_traceback;
23847 exc_info->exc_type = type;
23848 exc_info->exc_value = value;
23849 exc_info->exc_traceback = tb;
23851 tmp_type = tstate->exc_type;
23852 tmp_value = tstate->exc_value;
23853 tmp_tb = tstate->exc_traceback;
23854 tstate->exc_type = type;
23855 tstate->exc_value = value;
23856 tstate->exc_traceback = tb;
23858 Py_XDECREF(tmp_type);
23859 Py_XDECREF(tmp_value);
23860 Py_XDECREF(tmp_tb);
23865 #if CYTHON_FAST_THREAD_STATE
23866 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
23868 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
23871 PyObject *local_type, *local_value, *local_tb;
23872 #if CYTHON_FAST_THREAD_STATE
23873 PyObject *tmp_type, *tmp_value, *tmp_tb;
23874 local_type = tstate->curexc_type;
23875 local_value = tstate->curexc_value;
23876 local_tb = tstate->curexc_traceback;
23877 tstate->curexc_type = 0;
23878 tstate->curexc_value = 0;
23879 tstate->curexc_traceback = 0;
23881 PyErr_Fetch(&local_type, &local_value, &local_tb);
23883 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
23884 #if CYTHON_FAST_THREAD_STATE
23885 if (unlikely(tstate->curexc_type))
23887 if (unlikely(PyErr_Occurred()))
23890 #if PY_MAJOR_VERSION >= 3
23892 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
23896 Py_XINCREF(local_tb);
23897 Py_XINCREF(local_type);
23898 Py_XINCREF(local_value);
23899 *type = local_type;
23900 *value = local_value;
23902 #if CYTHON_FAST_THREAD_STATE
23903 #if CYTHON_USE_EXC_INFO_STACK
23905 _PyErr_StackItem *exc_info = tstate->exc_info;
23906 tmp_type = exc_info->exc_type;
23907 tmp_value = exc_info->exc_value;
23908 tmp_tb = exc_info->exc_traceback;
23909 exc_info->exc_type = local_type;
23910 exc_info->exc_value = local_value;
23911 exc_info->exc_traceback = local_tb;
23914 tmp_type = tstate->exc_type;
23915 tmp_value = tstate->exc_value;
23916 tmp_tb = tstate->exc_traceback;
23917 tstate->exc_type = local_type;
23918 tstate->exc_value = local_value;
23919 tstate->exc_traceback = local_tb;
23921 Py_XDECREF(tmp_type);
23922 Py_XDECREF(tmp_value);
23923 Py_XDECREF(tmp_tb);
23925 PyErr_SetExcInfo(local_type, local_value, local_tb);
23932 Py_XDECREF(local_type);
23933 Py_XDECREF(local_value);
23934 Py_XDECREF(local_tb);
23939 #if CYTHON_FAST_THREAD_STATE
23940 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23941 PyObject *tmp_type, *tmp_value, *tmp_tb;
23942 #if CYTHON_USE_EXC_INFO_STACK
23943 _PyErr_StackItem *exc_info = tstate->exc_info;
23944 tmp_type = exc_info->exc_type;
23945 tmp_value = exc_info->exc_value;
23946 tmp_tb = exc_info->exc_traceback;
23947 exc_info->exc_type = *type;
23948 exc_info->exc_value = *value;
23949 exc_info->exc_traceback = *tb;
23951 tmp_type = tstate->exc_type;
23952 tmp_value = tstate->exc_value;
23953 tmp_tb = tstate->exc_traceback;
23954 tstate->exc_type = *type;
23955 tstate->exc_value = *value;
23956 tstate->exc_traceback = *tb;
23959 *value = tmp_value;
23963 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
23964 PyObject *tmp_type, *tmp_value, *tmp_tb;
23965 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
23966 PyErr_SetExcInfo(*type, *value, *tb);
23968 *value = tmp_value;
23974 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
23975 PyObject *empty_list = 0;
23976 PyObject *module = 0;
23977 PyObject *global_dict = 0;
23978 PyObject *empty_dict = 0;
23980 #if PY_MAJOR_VERSION < 3
23981 PyObject *py_import;
23982 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
23989 empty_list = PyList_New(0);
23994 global_dict = PyModule_GetDict(__pyx_m);
23997 empty_dict = PyDict_New();
24001 #if PY_MAJOR_VERSION >= 3
24003 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
24004 module = PyImport_ImportModuleLevelObject(
24005 name, global_dict, empty_dict, list, 1);
24007 if (!PyErr_ExceptionMatches(PyExc_ImportError))
24016 #if PY_MAJOR_VERSION < 3
24017 PyObject *py_level = PyInt_FromLong(level);
24020 module = PyObject_CallFunctionObjArgs(py_import,
24021 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
24022 Py_DECREF(py_level);
24024 module = PyImport_ImportModuleLevelObject(
24025 name, global_dict, empty_dict, list, level);
24030 #if PY_MAJOR_VERSION < 3
24031 Py_XDECREF(py_import);
24033 Py_XDECREF(empty_list);
24034 Py_XDECREF(empty_dict);
24039 #if CYTHON_COMPILING_IN_CPYTHON
24040 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
24046 return b == &PyBaseObject_Type;
24048 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
24050 if (a == b)
return 1;
24054 n = PyTuple_GET_SIZE(mro);
24055 for (i = 0; i < n; i++) {
24056 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
24061 return __Pyx_InBases(a, b);
24063 #if PY_MAJOR_VERSION == 2
24064 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
24065 PyObject *exception, *value, *tb;
24067 __Pyx_PyThreadState_declare
24068 __Pyx_PyThreadState_assign
24069 __Pyx_ErrFetch(&exception, &value, &tb);
24070 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
24071 if (unlikely(res == -1)) {
24072 PyErr_WriteUnraisable(err);
24076 res = PyObject_IsSubclass(err, exc_type2);
24077 if (unlikely(res == -1)) {
24078 PyErr_WriteUnraisable(err);
24082 __Pyx_ErrRestore(exception, value, tb);
24086 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
24087 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
24089 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
24094 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24096 assert(PyExceptionClass_Check(exc_type));
24097 n = PyTuple_GET_SIZE(tuple);
24098 #if PY_MAJOR_VERSION >= 3
24099 for (i=0; i<n; i++) {
24100 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
24103 for (i=0; i<n; i++) {
24104 PyObject *t = PyTuple_GET_ITEM(tuple, i);
24105 #if PY_MAJOR_VERSION < 3
24106 if (likely(exc_type == t))
return 1;
24108 if (likely(PyExceptionClass_Check(t))) {
24109 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
24115 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
24116 if (likely(err == exc_type))
return 1;
24117 if (likely(PyExceptionClass_Check(err))) {
24118 if (likely(PyExceptionClass_Check(exc_type))) {
24119 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
24120 }
else if (likely(PyTuple_Check(exc_type))) {
24121 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
24125 return PyErr_GivenExceptionMatches(err, exc_type);
24127 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
24128 assert(PyExceptionClass_Check(exc_type1));
24129 assert(PyExceptionClass_Check(exc_type2));
24130 if (likely(err == exc_type1 || err == exc_type2))
return 1;
24131 if (likely(PyExceptionClass_Check(err))) {
24132 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
24134 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
24139 #if !CYTHON_COMPILING_IN_PYPY
24140 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
24142 (void)zerodivision_check;
24143 #if PY_MAJOR_VERSION < 3
24144 if (likely(PyInt_CheckExact(op1))) {
24145 const long b = intval;
24147 long a = PyInt_AS_LONG(op1);
24148 x = (long)((
unsigned long)a + b);
24149 if (likely((x^a) >= 0 || (x^b) >= 0))
24150 return PyInt_FromLong(x);
24151 return PyLong_Type.tp_as_number->nb_add(op1, op2);
24154 #if CYTHON_USE_PYLONG_INTERNALS
24155 if (likely(PyLong_CheckExact(op1))) {
24156 const long b = intval;
24158 #ifdef HAVE_LONG_LONG
24159 const PY_LONG_LONG llb = intval;
24160 PY_LONG_LONG lla, llx;
24162 const digit* digits = ((PyLongObject*)op1)->ob_digit;
24163 const Py_ssize_t size = Py_SIZE(op1);
24164 if (likely(__Pyx_sst_abs(size) <= 1)) {
24165 a = likely(size) ? digits[0] : 0;
24166 if (size == -1) a = -a;
24170 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
24171 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24173 #ifdef HAVE_LONG_LONG
24174 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24175 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24179 CYTHON_FALLTHROUGH;
24181 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
24182 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24184 #ifdef HAVE_LONG_LONG
24185 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24186 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24190 CYTHON_FALLTHROUGH;
24192 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
24193 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24195 #ifdef HAVE_LONG_LONG
24196 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24197 lla = -(PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24201 CYTHON_FALLTHROUGH;
24203 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
24204 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24206 #ifdef HAVE_LONG_LONG
24207 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24208 lla = (PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24212 CYTHON_FALLTHROUGH;
24214 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
24215 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24217 #ifdef HAVE_LONG_LONG
24218 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24219 lla = -(PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24223 CYTHON_FALLTHROUGH;
24225 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
24226 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24228 #ifdef HAVE_LONG_LONG
24229 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24230 lla = (PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24234 CYTHON_FALLTHROUGH;
24235 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
24239 return PyLong_FromLong(x);
24240 #ifdef HAVE_LONG_LONG
24243 return PyLong_FromLongLong(llx);
24249 if (PyFloat_CheckExact(op1)) {
24250 const long b = intval;
24251 double a = PyFloat_AS_DOUBLE(op1);
24253 PyFPE_START_PROTECT(
"add",
return NULL)
24254 result = ((double)a) + (double)b;
24255 PyFPE_END_PROTECT(result)
24256 return PyFloat_FromDouble(result);
24258 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24263 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
24264 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
24268 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
24269 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
24270 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24271 PyErr_Format(PyExc_ImportError,
24272 #
if PY_MAJOR_VERSION < 3
24273 "cannot import name %.230s", PyString_AS_STRING(name));
24275 "cannot import name %S", name);
24282 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *n) {
24284 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
24285 PyErr_SetString(PyExc_TypeError,
24286 "hasattr(): attribute name must be string");
24289 r = __Pyx_GetAttr(o, n);
24290 if (unlikely(!r)) {
24300 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24301 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
24302 PyErr_Format(PyExc_AttributeError,
24303 #
if PY_MAJOR_VERSION >= 3
24304 "'%.50s' object has no attribute '%U'",
24305 tp->tp_name, attr_name);
24307 "'%.50s' object has no attribute '%.400s'",
24308 tp->tp_name, PyString_AS_STRING(attr_name));
24312 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
24314 PyTypeObject *tp = Py_TYPE(obj);
24315 if (unlikely(!PyString_Check(attr_name))) {
24316 return PyObject_GenericGetAttr(obj, attr_name);
24318 assert(!tp->tp_dictoffset);
24319 descr = _PyType_Lookup(tp, attr_name);
24320 if (unlikely(!descr)) {
24321 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
24324 #if PY_MAJOR_VERSION < 3
24325 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
24328 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
24330 PyObject *res = f(descr, obj, (PyObject *)tp);
24340 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24341 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
24342 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
24343 return PyObject_GenericGetAttr(obj, attr_name);
24345 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
24350 static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
24351 #if PY_VERSION_HEX >= 0x02070000
24352 PyObject *ob = PyCapsule_New(vtable, 0, 0);
24354 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
24358 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
24368 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
24369 __Pyx_PyThreadState_declare
24370 __Pyx_PyThreadState_assign
24371 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24372 __Pyx_PyErr_Clear();
24374 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
24376 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
24377 PyTypeObject* tp = Py_TYPE(obj);
24378 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
24379 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
24382 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
24383 if (unlikely(!result)) {
24384 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
24390 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
24392 PyObject *name_attr;
24393 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
24394 if (likely(name_attr)) {
24395 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
24399 if (unlikely(ret < 0)) {
24403 Py_XDECREF(name_attr);
24406 static int __Pyx_setup_reduce(PyObject* type_obj) {
24408 PyObject *object_reduce = NULL;
24409 PyObject *object_getstate = NULL;
24410 PyObject *object_reduce_ex = NULL;
24411 PyObject *reduce = NULL;
24412 PyObject *reduce_ex = NULL;
24413 PyObject *reduce_cython = NULL;
24414 PyObject *setstate = NULL;
24415 PyObject *setstate_cython = NULL;
24416 PyObject *getstate = NULL;
24417 #if CYTHON_USE_PYTYPE_LOOKUP
24418 getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
24420 getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
24421 if (!getstate && PyErr_Occurred()) {
24426 #if CYTHON_USE_PYTYPE_LOOKUP
24427 object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
24429 object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
24430 if (!object_getstate && PyErr_Occurred()) {
24434 if (object_getstate != getstate) {
24438 #if CYTHON_USE_PYTYPE_LOOKUP
24439 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
24441 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
24443 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
24444 if (reduce_ex == object_reduce_ex) {
24445 #if CYTHON_USE_PYTYPE_LOOKUP
24446 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
24448 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
24450 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
24451 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
24452 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
24453 if (likely(reduce_cython)) {
24454 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24455 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24456 }
else if (reduce == object_reduce || PyErr_Occurred()) {
24459 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
24460 if (!setstate) PyErr_Clear();
24461 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
24462 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
24463 if (likely(setstate_cython)) {
24464 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24465 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24466 }
else if (!setstate || PyErr_Occurred()) {
24470 PyType_Modified((PyTypeObject*)type_obj);
24475 if (!PyErr_Occurred())
24476 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
24479 #if !CYTHON_USE_PYTYPE_LOOKUP
24480 Py_XDECREF(object_reduce);
24481 Py_XDECREF(object_reduce_ex);
24482 Py_XDECREF(object_getstate);
24483 Py_XDECREF(getstate);
24485 Py_XDECREF(reduce);
24486 Py_XDECREF(reduce_ex);
24487 Py_XDECREF(reduce_cython);
24488 Py_XDECREF(setstate);
24489 Py_XDECREF(setstate_cython);
24494 #ifndef __PYX_HAVE_RT_ImportType_0_29_36
24495 #define __PYX_HAVE_RT_ImportType_0_29_36
24496 static PyTypeObject *__Pyx_ImportType_0_29_36(PyObject *module,
const char *module_name,
const char *class_name,
24497 size_t size,
size_t alignment,
enum __Pyx_ImportType_CheckSize_0_29_36 check_size)
24499 PyObject *result = 0;
24501 Py_ssize_t basicsize;
24502 Py_ssize_t itemsize;
24503 #ifdef Py_LIMITED_API
24504 PyObject *py_basicsize;
24505 PyObject *py_itemsize;
24507 result = PyObject_GetAttrString(module, class_name);
24510 if (!PyType_Check(result)) {
24511 PyErr_Format(PyExc_TypeError,
24512 "%.200s.%.200s is not a type object",
24513 module_name, class_name);
24516 #ifndef Py_LIMITED_API
24517 basicsize = ((PyTypeObject *)result)->tp_basicsize;
24518 itemsize = ((PyTypeObject *)result)->tp_itemsize;
24520 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
24523 basicsize = PyLong_AsSsize_t(py_basicsize);
24524 Py_DECREF(py_basicsize);
24526 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
24528 py_itemsize = PyObject_GetAttrString(result,
"__itemsize__");
24531 itemsize = PyLong_AsSsize_t(py_itemsize);
24532 Py_DECREF(py_itemsize);
24534 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
24538 if (size % alignment) {
24539 alignment = size % alignment;
24541 if (itemsize < (Py_ssize_t)alignment)
24542 itemsize = (Py_ssize_t)alignment;
24544 if ((
size_t)(basicsize + itemsize) < size) {
24545 PyErr_Format(PyExc_ValueError,
24546 "%.200s.%.200s size changed, may indicate binary incompatibility. "
24547 "Expected %zd from C header, got %zd from PyObject",
24548 module_name, class_name, size, basicsize);
24551 if (check_size == __Pyx_ImportType_CheckSize_Error_0_29_36 && (
size_t)basicsize != size) {
24552 PyErr_Format(PyExc_ValueError,
24553 "%.200s.%.200s size changed, may indicate binary incompatibility. "
24554 "Expected %zd from C header, got %zd from PyObject",
24555 module_name, class_name, size, basicsize);
24558 else if (check_size == __Pyx_ImportType_CheckSize_Warn_0_29_36 && (
size_t)basicsize > size) {
24559 PyOS_snprintf(warning,
sizeof(warning),
24560 "%s.%s size changed, may indicate binary incompatibility. "
24561 "Expected %zd from C header, got %zd from PyObject",
24562 module_name, class_name, size, basicsize);
24563 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
24565 return (PyTypeObject *)result;
24567 Py_XDECREF(result);
24573 static void* __Pyx_GetVtable(PyObject *dict) {
24575 PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
24578 #if PY_VERSION_HEX >= 0x02070000
24579 ptr = PyCapsule_GetPointer(ob, 0);
24581 ptr = PyCObject_AsVoidPtr(ob);
24583 if (!ptr && !PyErr_Occurred())
24584 PyErr_SetString(PyExc_RuntimeError,
"invalid vtable found for imported type");
24593 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
24594 PyObject* fake_module;
24595 PyTypeObject* cached_type = NULL;
24596 fake_module = PyImport_AddModule((
char*)
"_cython_" CYTHON_ABI);
24597 if (!fake_module)
return NULL;
24598 Py_INCREF(fake_module);
24599 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
24601 if (!PyType_Check((PyObject*)cached_type)) {
24602 PyErr_Format(PyExc_TypeError,
24603 "Shared Cython type %.200s is not a type object",
24607 if (cached_type->tp_basicsize != type->tp_basicsize) {
24608 PyErr_Format(PyExc_TypeError,
24609 "Shared Cython type %.200s has the wrong size, try recompiling",
24614 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
24616 if (PyType_Ready(type) < 0)
goto bad;
24617 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
24620 cached_type = type;
24623 Py_DECREF(fake_module);
24624 return cached_type;
24626 Py_XDECREF(cached_type);
24627 cached_type = NULL;
24632 #include <structmember.h>
24634 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *closure)
24636 if (unlikely(op->func_doc == NULL)) {
24637 if (op->func.m_ml->ml_doc) {
24638 #if PY_MAJOR_VERSION >= 3
24639 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
24641 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
24643 if (unlikely(op->func_doc == NULL))
24646 Py_INCREF(Py_None);
24650 Py_INCREF(op->func_doc);
24651 return op->func_doc;
24654 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24656 PyObject *tmp = op->func_doc;
24657 if (value == NULL) {
24661 op->func_doc = value;
24666 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24668 if (unlikely(op->func_name == NULL)) {
24669 #if PY_MAJOR_VERSION >= 3
24670 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
24672 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
24674 if (unlikely(op->func_name == NULL))
24677 Py_INCREF(op->func_name);
24678 return op->func_name;
24681 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24684 #if PY_MAJOR_VERSION >= 3
24685 if (unlikely(value == NULL || !PyUnicode_Check(value)))
24687 if (unlikely(value == NULL || !PyString_Check(value)))
24690 PyErr_SetString(PyExc_TypeError,
24691 "__name__ must be set to a string object");
24694 tmp = op->func_name;
24696 op->func_name = value;
24701 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24703 Py_INCREF(op->func_qualname);
24704 return op->func_qualname;
24707 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24710 #if PY_MAJOR_VERSION >= 3
24711 if (unlikely(value == NULL || !PyUnicode_Check(value)))
24713 if (unlikely(value == NULL || !PyString_Check(value)))
24716 PyErr_SetString(PyExc_TypeError,
24717 "__qualname__ must be set to a string object");
24720 tmp = op->func_qualname;
24722 op->func_qualname = value;
24727 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED
void *closure)
24730 self = m->func_closure;
24737 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24739 if (unlikely(op->func_dict == NULL)) {
24740 op->func_dict = PyDict_New();
24741 if (unlikely(op->func_dict == NULL))
24744 Py_INCREF(op->func_dict);
24745 return op->func_dict;
24748 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24751 if (unlikely(value == NULL)) {
24752 PyErr_SetString(PyExc_TypeError,
24753 "function's dictionary may not be deleted");
24756 if (unlikely(!PyDict_Check(value))) {
24757 PyErr_SetString(PyExc_TypeError,
24758 "setting function's dictionary to a non-dict");
24761 tmp = op->func_dict;
24763 op->func_dict = value;
24768 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24770 Py_INCREF(op->func_globals);
24771 return op->func_globals;
24774 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24776 Py_INCREF(Py_None);
24780 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24782 PyObject* result = (op->func_code) ? op->func_code : Py_None;
24787 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
24789 PyObject *res = op->defaults_getter((PyObject *) op);
24790 if (unlikely(!res))
24792 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24793 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
24794 Py_INCREF(op->defaults_tuple);
24795 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
24796 Py_INCREF(op->defaults_kwdict);
24798 op->defaults_tuple = PySequence_ITEM(res, 0);
24799 if (unlikely(!op->defaults_tuple)) result = -1;
24801 op->defaults_kwdict = PySequence_ITEM(res, 1);
24802 if (unlikely(!op->defaults_kwdict)) result = -1;
24809 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24813 }
else if (value != Py_None && !PyTuple_Check(value)) {
24814 PyErr_SetString(PyExc_TypeError,
24815 "__defaults__ must be set to a tuple object");
24819 tmp = op->defaults_tuple;
24820 op->defaults_tuple = value;
24825 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24826 PyObject* result = op->defaults_tuple;
24827 if (unlikely(!result)) {
24828 if (op->defaults_getter) {
24829 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
24830 result = op->defaults_tuple;
24839 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24843 }
else if (value != Py_None && !PyDict_Check(value)) {
24844 PyErr_SetString(PyExc_TypeError,
24845 "__kwdefaults__ must be set to a dict object");
24849 tmp = op->defaults_kwdict;
24850 op->defaults_kwdict = value;
24855 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24856 PyObject* result = op->defaults_kwdict;
24857 if (unlikely(!result)) {
24858 if (op->defaults_getter) {
24859 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
24860 result = op->defaults_kwdict;
24869 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24871 if (!value || value == Py_None) {
24873 }
else if (!PyDict_Check(value)) {
24874 PyErr_SetString(PyExc_TypeError,
24875 "__annotations__ must be set to a dict object");
24879 tmp = op->func_annotations;
24880 op->func_annotations = value;
24885 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24886 PyObject* result = op->func_annotations;
24887 if (unlikely(!result)) {
24888 result = PyDict_New();
24889 if (unlikely(!result))
return NULL;
24890 op->func_annotations = result;
24895 static PyGetSetDef __pyx_CyFunction_getsets[] = {
24896 {(
char *)
"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
24897 {(
char *)
"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
24898 {(
char *)
"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
24899 {(
char *)
"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
24900 {(
char *)
"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
24901 {(
char *)
"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
24902 {(
char *)
"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
24903 {(
char *)
"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
24904 {(
char *)
"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
24905 {(
char *)
"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
24906 {(
char *)
"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
24907 {(
char *)
"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
24908 {(
char *)
"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
24909 {(
char *)
"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
24910 {(
char *)
"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
24911 {(
char *)
"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
24912 {(
char *)
"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
24913 {(
char *)
"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
24916 static PyMemberDef __pyx_CyFunction_members[] = {
24917 {(
char *)
"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
24921 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
24923 #if PY_MAJOR_VERSION >= 3
24924 Py_INCREF(m->func_qualname);
24925 return m->func_qualname;
24927 return PyString_FromString(m->func.m_ml->ml_name);
24930 static PyMethodDef __pyx_CyFunction_methods[] = {
24931 {
"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
24934 #if PY_VERSION_HEX < 0x030500A0
24935 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
24937 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
24939 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml,
int flags, PyObject* qualname,
24940 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
24941 if (unlikely(op == NULL))
24944 __Pyx_CyFunction_weakreflist(op) = NULL;
24945 op->func.m_ml = ml;
24946 op->func.m_self = (PyObject *) op;
24947 Py_XINCREF(closure);
24948 op->func_closure = closure;
24949 Py_XINCREF(module);
24950 op->func.m_module = module;
24951 op->func_dict = NULL;
24952 op->func_name = NULL;
24953 Py_INCREF(qualname);
24954 op->func_qualname = qualname;
24955 op->func_doc = NULL;
24956 op->func_classobj = NULL;
24957 op->func_globals = globals;
24958 Py_INCREF(op->func_globals);
24960 op->func_code = code;
24961 op->defaults_pyobjects = 0;
24962 op->defaults_size = 0;
24963 op->defaults = NULL;
24964 op->defaults_tuple = NULL;
24965 op->defaults_kwdict = NULL;
24966 op->defaults_getter = NULL;
24967 op->func_annotations = NULL;
24968 return (PyObject *) op;
24971 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
24973 Py_CLEAR(m->func_closure);
24974 Py_CLEAR(m->func.m_module);
24975 Py_CLEAR(m->func_dict);
24976 Py_CLEAR(m->func_name);
24977 Py_CLEAR(m->func_qualname);
24978 Py_CLEAR(m->func_doc);
24979 Py_CLEAR(m->func_globals);
24980 Py_CLEAR(m->func_code);
24981 Py_CLEAR(m->func_classobj);
24982 Py_CLEAR(m->defaults_tuple);
24983 Py_CLEAR(m->defaults_kwdict);
24984 Py_CLEAR(m->func_annotations);
24986 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
24988 for (i = 0; i < m->defaults_pyobjects; i++)
24989 Py_XDECREF(pydefaults[i]);
24990 PyObject_Free(m->defaults);
24991 m->defaults = NULL;
24995 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
24997 if (__Pyx_CyFunction_weakreflist(m) != NULL)
24998 PyObject_ClearWeakRefs((PyObject *) m);
24999 __Pyx_CyFunction_clear(m);
25000 PyObject_GC_Del(m);
25002 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
25004 PyObject_GC_UnTrack(m);
25005 __Pyx__CyFunction_dealloc(m);
25007 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
void *arg)
25009 Py_VISIT(m->func_closure);
25010 Py_VISIT(m->func.m_module);
25011 Py_VISIT(m->func_dict);
25012 Py_VISIT(m->func_name);
25013 Py_VISIT(m->func_qualname);
25014 Py_VISIT(m->func_doc);
25015 Py_VISIT(m->func_globals);
25016 Py_VISIT(m->func_code);
25017 Py_VISIT(m->func_classobj);
25018 Py_VISIT(m->defaults_tuple);
25019 Py_VISIT(m->defaults_kwdict);
25021 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
25023 for (i = 0; i < m->defaults_pyobjects; i++)
25024 Py_VISIT(pydefaults[i]);
25028 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
25030 #if PY_MAJOR_VERSION < 3
25031 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25032 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
25036 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
25038 type = (PyObject *)(Py_TYPE(obj));
25039 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
25041 if (obj == Py_None)
25044 return __Pyx_PyMethod_New(func, obj, type);
25047 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
25049 #if PY_MAJOR_VERSION >= 3
25050 return PyUnicode_FromFormat(
"<cyfunction %U at %p>",
25051 op->func_qualname, (
void *)op);
25053 return PyString_FromFormat(
"<cyfunction %s at %p>",
25054 PyString_AsString(op->func_qualname), (
void *)op);
25057 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *
self, PyObject *arg, PyObject *kw) {
25058 PyCFunctionObject* f = (PyCFunctionObject*)func;
25059 PyCFunction meth = f->m_ml->ml_meth;
25061 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
25063 if (likely(kw == NULL || PyDict_Size(kw) == 0))
25064 return (*meth)(
self, arg);
25066 case METH_VARARGS | METH_KEYWORDS:
25067 return (*(PyCFunctionWithKeywords)(
void*)meth)(
self, arg, kw);
25069 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
25070 size = PyTuple_GET_SIZE(arg);
25071 if (likely(size == 0))
25072 return (*meth)(
self, NULL);
25073 PyErr_Format(PyExc_TypeError,
25074 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T
"d given)",
25075 f->m_ml->ml_name, size);
25080 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
25081 size = PyTuple_GET_SIZE(arg);
25082 if (likely(size == 1)) {
25083 PyObject *result, *arg0;
25084 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25085 arg0 = PyTuple_GET_ITEM(arg, 0);
25087 arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0))
return NULL;
25089 result = (*meth)(
self, arg0);
25090 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
25095 PyErr_Format(PyExc_TypeError,
25096 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T
"d given)",
25097 f->m_ml->ml_name, size);
25102 PyErr_SetString(PyExc_SystemError,
"Bad call flags in "
25103 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
25104 "longer supported!");
25107 PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
25111 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
25112 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
25114 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
25116 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
25117 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
25119 PyObject *new_args;
25121 argc = PyTuple_GET_SIZE(args);
25122 new_args = PyTuple_GetSlice(args, 1, argc);
25123 if (unlikely(!new_args))
25125 self = PyTuple_GetItem(args, 0);
25126 if (unlikely(!
self)) {
25127 Py_DECREF(new_args);
25128 #if PY_MAJOR_VERSION > 2
25129 PyErr_Format(PyExc_TypeError,
25130 "unbound method %.200S() needs an argument",
25131 cyfunc->func_qualname);
25133 PyErr_SetString(PyExc_TypeError,
25134 "unbound method needs an argument");
25138 result = __Pyx_CyFunction_CallMethod(func,
self, new_args, kw);
25139 Py_DECREF(new_args);
25141 result = __Pyx_CyFunction_Call(func, args, kw);
25145 static PyTypeObject __pyx_CyFunctionType_type = {
25146 PyVarObject_HEAD_INIT(0, 0)
25147 "cython_function_or_method",
25148 sizeof(__pyx_CyFunctionObject),
25150 (destructor) __Pyx_CyFunction_dealloc,
25154 #if PY_MAJOR_VERSION < 3
25159 (reprfunc) __Pyx_CyFunction_repr,
25164 __Pyx_CyFunction_CallAsMethod,
25169 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
25171 (traverseproc) __Pyx_CyFunction_traverse,
25172 (inquiry) __Pyx_CyFunction_clear,
25174 #
if PY_VERSION_HEX < 0x030500A0
25175 offsetof(__pyx_CyFunctionObject, func_weakreflist),
25177 offsetof(PyCFunctionObject, m_weakreflist),
25181 __pyx_CyFunction_methods,
25182 __pyx_CyFunction_members,
25183 __pyx_CyFunction_getsets,
25186 __Pyx_CyFunction_descr_get,
25188 offsetof(__pyx_CyFunctionObject, func_dict),
25201 #if PY_VERSION_HEX >= 0x030400a1
25204 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
25207 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
25210 #if PY_VERSION_HEX >= 0x030C0000
25213 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
25217 static int __pyx_CyFunction_init(
void) {
25218 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
25219 if (unlikely(__pyx_CyFunctionType == NULL)) {
25224 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *func,
size_t size,
int pyobjects) {
25225 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25226 m->defaults = PyObject_Malloc(size);
25227 if (unlikely(!m->defaults))
25228 return PyErr_NoMemory();
25229 memset(m->defaults, 0, size);
25230 m->defaults_pyobjects = pyobjects;
25231 m->defaults_size = size;
25232 return m->defaults;
25234 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
25235 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25236 m->defaults_tuple = tuple;
25239 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
25240 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25241 m->defaults_kwdict = dict;
25244 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
25245 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25246 m->func_annotations = dict;
25251 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
int flags, PyObject* qualname,
25252 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
25253 PyObject *op = __Pyx_CyFunction_Init(
25254 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
25255 ml, flags, qualname, closure, module, globals, code
25258 PyObject_GC_Track(op);
25264 #ifndef CYTHON_CLINE_IN_TRACEBACK
25265 static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate,
int c_line) {
25266 PyObject *use_cline;
25267 PyObject *ptype, *pvalue, *ptraceback;
25268 #if CYTHON_COMPILING_IN_CPYTHON
25269 PyObject **cython_runtime_dict;
25271 if (unlikely(!__pyx_cython_runtime)) {
25274 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25275 #if CYTHON_COMPILING_IN_CPYTHON
25276 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
25277 if (likely(cython_runtime_dict)) {
25278 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
25279 use_cline, *cython_runtime_dict,
25280 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
25284 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
25285 if (use_cline_obj) {
25286 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
25287 Py_DECREF(use_cline_obj);
25295 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25297 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25300 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25306 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
25307 int start = 0, mid = 0, end = count - 1;
25308 if (end >= 0 && code_line > entries[end].code_line) {
25311 while (start < end) {
25312 mid = start + (end - start) / 2;
25313 if (code_line < entries[mid].code_line) {
25315 }
else if (code_line > entries[mid].code_line) {
25321 if (code_line <= entries[mid].code_line) {
25327 static PyCodeObject *__pyx_find_code_object(
int code_line) {
25328 PyCodeObject* code_object;
25330 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25333 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25334 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
25337 code_object = __pyx_code_cache.entries[pos].code_object;
25338 Py_INCREF(code_object);
25339 return code_object;
25341 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
25343 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25344 if (unlikely(!code_line)) {
25347 if (unlikely(!entries)) {
25348 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
25349 if (likely(entries)) {
25350 __pyx_code_cache.entries = entries;
25351 __pyx_code_cache.max_count = 64;
25352 __pyx_code_cache.count = 1;
25353 entries[0].code_line = code_line;
25354 entries[0].code_object = code_object;
25355 Py_INCREF(code_object);
25359 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25360 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
25361 PyCodeObject* tmp = entries[pos].code_object;
25362 entries[pos].code_object = code_object;
25366 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
25367 int new_max = __pyx_code_cache.max_count + 64;
25368 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
25369 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
25370 if (unlikely(!entries)) {
25373 __pyx_code_cache.entries = entries;
25374 __pyx_code_cache.max_count = new_max;
25376 for (i=__pyx_code_cache.count; i>pos; i--) {
25377 entries[i] = entries[i-1];
25379 entries[pos].code_line = code_line;
25380 entries[pos].code_object = code_object;
25381 __pyx_code_cache.count++;
25382 Py_INCREF(code_object);
25386 #include "compile.h"
25387 #include "frameobject.h"
25388 #include "traceback.h"
25389 #if PY_VERSION_HEX >= 0x030b00a6
25390 #ifndef Py_BUILD_CORE
25391 #define Py_BUILD_CORE 1
25393 #include "internal/pycore_frame.h"
25395 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
25396 const char *funcname,
int c_line,
25397 int py_line,
const char *filename) {
25398 PyCodeObject *py_code = NULL;
25399 PyObject *py_funcname = NULL;
25400 #if PY_MAJOR_VERSION < 3
25401 PyObject *py_srcfile = NULL;
25402 py_srcfile = PyString_FromString(filename);
25403 if (!py_srcfile)
goto bad;
25406 #if PY_MAJOR_VERSION < 3
25407 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25408 if (!py_funcname)
goto bad;
25410 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25411 if (!py_funcname)
goto bad;
25412 funcname = PyUnicode_AsUTF8(py_funcname);
25413 if (!funcname)
goto bad;
25417 #if PY_MAJOR_VERSION < 3
25418 py_funcname = PyString_FromString(funcname);
25419 if (!py_funcname)
goto bad;
25422 #if PY_MAJOR_VERSION < 3
25423 py_code = __Pyx_PyCode_New(
25440 Py_DECREF(py_srcfile);
25442 py_code = PyCode_NewEmpty(filename, funcname, py_line);
25444 Py_XDECREF(py_funcname);
25447 Py_XDECREF(py_funcname);
25448 #if PY_MAJOR_VERSION < 3
25449 Py_XDECREF(py_srcfile);
25453 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
25454 int py_line,
const char *filename) {
25455 PyCodeObject *py_code = 0;
25456 PyFrameObject *py_frame = 0;
25457 PyThreadState *tstate = __Pyx_PyThreadState_Current;
25458 PyObject *ptype, *pvalue, *ptraceback;
25460 c_line = __Pyx_CLineForTraceback(tstate, c_line);
25462 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
25464 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25465 py_code = __Pyx_CreateCodeObjectForTraceback(
25466 funcname, c_line, py_line, filename);
25471 Py_XDECREF(pvalue);
25472 Py_XDECREF(ptraceback);
25475 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25476 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
25478 py_frame = PyFrame_New(
25484 if (!py_frame)
goto bad;
25485 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
25486 PyTraceBack_Here(py_frame);
25488 Py_XDECREF(py_code);
25489 Py_XDECREF(py_frame);
25492 #if PY_MAJOR_VERSION < 3
25493 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
25494 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
25495 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
25496 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
25497 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
25500 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
25501 PyObject *obj = view->obj;
25503 if (PyObject_CheckBuffer(obj)) {
25504 PyBuffer_Release(view);
25516 __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
25518 int i, index, step, start;
25519 Py_ssize_t itemsize = mvs.memview->view.itemsize;
25520 if (order ==
'F') {
25527 for (i = 0; i < ndim; i++) {
25528 index = start + step * i;
25529 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
25531 itemsize *= mvs.shape[index];
25538 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
25539 void **out_start,
void **out_end,
25540 int ndim,
size_t itemsize)
25544 start = end = slice->data;
25545 for (i = 0; i < ndim; i++) {
25546 Py_ssize_t stride = slice->strides[i];
25547 Py_ssize_t extent = slice->shape[i];
25549 *out_start = *out_end = start;
25553 end += stride * (extent - 1);
25555 start += stride * (extent - 1);
25558 *out_start = start;
25559 *out_end = end + itemsize;
25562 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
25563 __Pyx_memviewslice *slice2,
25564 int ndim,
size_t itemsize)
25566 void *start1, *end1, *start2, *end2;
25567 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
25568 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
25569 return (start1 < end2) && (start2 < end1);
25573 static CYTHON_INLINE PyObject *
25574 __pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
25577 #if PY_VERSION_HEX >= 0x02070000
25578 cobj = PyCapsule_New(p, sig, NULL);
25580 cobj = PyCObject_FromVoidPtr(p, NULL);
25586 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25587 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25588 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25589 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25590 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25592 func_type value = func_value;\
25593 if (sizeof(target_type) < sizeof(func_type)) {\
25594 if (unlikely(value != (func_type) (target_type) value)) {\
25595 func_type zero = 0;\
25596 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25597 return (target_type) -1;\
25598 if (is_unsigned && unlikely(value < zero))\
25599 goto raise_neg_overflow;\
25601 goto raise_overflow;\
25604 return (target_type) value;\
25608 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void)
25614 S.u32 = 0x01020304;
25615 return S.u8[0] == 4;
25619 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
25620 __Pyx_BufFmt_StackElem* stack,
25621 __Pyx_TypeInfo* type) {
25622 stack[0].field = &ctx->root;
25623 stack[0].parent_offset = 0;
25624 ctx->root.type = type;
25625 ctx->root.name =
"buffer dtype";
25626 ctx->root.offset = 0;
25628 ctx->head->field = &ctx->root;
25629 ctx->fmt_offset = 0;
25630 ctx->head->parent_offset = 0;
25631 ctx->new_packmode =
'@';
25632 ctx->enc_packmode =
'@';
25633 ctx->new_count = 1;
25634 ctx->enc_count = 0;
25636 ctx->is_complex = 0;
25637 ctx->is_valid_array = 0;
25638 ctx->struct_alignment = 0;
25639 while (type->typegroup ==
'S') {
25641 ctx->head->field = type->fields;
25642 ctx->head->parent_offset = 0;
25643 type = type->fields->type;
25646 static int __Pyx_BufFmt_ParseNumber(
const char** ts) {
25648 const char* t = *ts;
25649 if (*t < '0' || *t >
'9') {
25652 count = *t++ -
'0';
25653 while (*t >=
'0' && *t <=
'9') {
25655 count += *t++ -
'0';
25661 static int __Pyx_BufFmt_ExpectNumber(
const char **ts) {
25662 int number = __Pyx_BufFmt_ParseNumber(ts);
25664 PyErr_Format(PyExc_ValueError,\
25665 "Does not understand character buffer dtype format string ('%c')", **ts);
25668 static void __Pyx_BufFmt_RaiseUnexpectedChar(
char ch) {
25669 PyErr_Format(PyExc_ValueError,
25670 "Unexpected format string character: '%c'", ch);
25672 static const char* __Pyx_BufFmt_DescribeTypeChar(
char ch,
int is_complex) {
25674 case '?':
return "'bool'";
25675 case 'c':
return "'char'";
25676 case 'b':
return "'signed char'";
25677 case 'B':
return "'unsigned char'";
25678 case 'h':
return "'short'";
25679 case 'H':
return "'unsigned short'";
25680 case 'i':
return "'int'";
25681 case 'I':
return "'unsigned int'";
25682 case 'l':
return "'long'";
25683 case 'L':
return "'unsigned long'";
25684 case 'q':
return "'long long'";
25685 case 'Q':
return "'unsigned long long'";
25686 case 'f':
return (is_complex ?
"'complex float'" :
"'float'");
25687 case 'd':
return (is_complex ?
"'complex double'" :
"'double'");
25688 case 'g':
return (is_complex ?
"'complex long double'" :
"'long double'");
25689 case 'T':
return "a struct";
25690 case 'O':
return "Python object";
25691 case 'P':
return "a pointer";
25692 case 's':
case 'p':
return "a string";
25693 case 0:
return "end";
25694 default:
return "unparseable format string";
25697 static size_t __Pyx_BufFmt_TypeCharToStandardSize(
char ch,
int is_complex) {
25699 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25700 case 'h':
case 'H':
return 2;
25701 case 'i':
case 'I':
case 'l':
case 'L':
return 4;
25702 case 'q':
case 'Q':
return 8;
25703 case 'f':
return (is_complex ? 8 : 4);
25704 case 'd':
return (is_complex ? 16 : 8);
25706 PyErr_SetString(PyExc_ValueError,
"Python does not define a standard format string size for long double ('g')..");
25709 case 'O':
case 'P':
return sizeof(
void*);
25711 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25715 static size_t __Pyx_BufFmt_TypeCharToNativeSize(
char ch,
int is_complex) {
25717 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25718 case 'h':
case 'H':
return sizeof(short);
25719 case 'i':
case 'I':
return sizeof(int);
25720 case 'l':
case 'L':
return sizeof(long);
25721 #ifdef HAVE_LONG_LONG
25722 case 'q':
case 'Q':
return sizeof(PY_LONG_LONG);
25724 case 'f':
return sizeof(float) * (is_complex ? 2 : 1);
25725 case 'd':
return sizeof(double) * (is_complex ? 2 : 1);
25726 case 'g':
return sizeof(
long double) * (is_complex ? 2 : 1);
25727 case 'O':
case 'P':
return sizeof(
void*);
25729 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25734 typedef struct {
char c;
short x; } __Pyx_st_short;
25735 typedef struct {
char c;
int x; } __Pyx_st_int;
25736 typedef struct {
char c;
long x; } __Pyx_st_long;
25737 typedef struct {
char c;
float x; } __Pyx_st_float;
25738 typedef struct {
char c;
double x; } __Pyx_st_double;
25739 typedef struct {
char c;
long double x; } __Pyx_st_longdouble;
25740 typedef struct {
char c;
void *x; } __Pyx_st_void_p;
25741 #ifdef HAVE_LONG_LONG
25742 typedef struct {
char c; PY_LONG_LONG x; } __Pyx_st_longlong;
25744 static size_t __Pyx_BufFmt_TypeCharToAlignment(
char ch, CYTHON_UNUSED
int is_complex) {
25746 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25747 case 'h':
case 'H':
return sizeof(__Pyx_st_short) -
sizeof(
short);
25748 case 'i':
case 'I':
return sizeof(__Pyx_st_int) -
sizeof(
int);
25749 case 'l':
case 'L':
return sizeof(__Pyx_st_long) -
sizeof(
long);
25750 #ifdef HAVE_LONG_LONG
25751 case 'q':
case 'Q':
return sizeof(__Pyx_st_longlong) -
sizeof(PY_LONG_LONG);
25753 case 'f':
return sizeof(__Pyx_st_float) -
sizeof(
float);
25754 case 'd':
return sizeof(__Pyx_st_double) -
sizeof(
double);
25755 case 'g':
return sizeof(__Pyx_st_longdouble) -
sizeof(
long double);
25756 case 'P':
case 'O':
return sizeof(__Pyx_st_void_p) -
sizeof(
void*);
25758 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25766 typedef struct {
short x;
char c; } __Pyx_pad_short;
25767 typedef struct {
int x;
char c; } __Pyx_pad_int;
25768 typedef struct {
long x;
char c; } __Pyx_pad_long;
25769 typedef struct {
float x;
char c; } __Pyx_pad_float;
25770 typedef struct {
double x;
char c; } __Pyx_pad_double;
25771 typedef struct {
long double x;
char c; } __Pyx_pad_longdouble;
25772 typedef struct {
void *x;
char c; } __Pyx_pad_void_p;
25773 #ifdef HAVE_LONG_LONG
25774 typedef struct { PY_LONG_LONG x;
char c; } __Pyx_pad_longlong;
25776 static size_t __Pyx_BufFmt_TypeCharToPadding(
char ch, CYTHON_UNUSED
int is_complex) {
25778 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25779 case 'h':
case 'H':
return sizeof(__Pyx_pad_short) -
sizeof(
short);
25780 case 'i':
case 'I':
return sizeof(__Pyx_pad_int) -
sizeof(
int);
25781 case 'l':
case 'L':
return sizeof(__Pyx_pad_long) -
sizeof(
long);
25782 #ifdef HAVE_LONG_LONG
25783 case 'q':
case 'Q':
return sizeof(__Pyx_pad_longlong) -
sizeof(PY_LONG_LONG);
25785 case 'f':
return sizeof(__Pyx_pad_float) -
sizeof(
float);
25786 case 'd':
return sizeof(__Pyx_pad_double) -
sizeof(
double);
25787 case 'g':
return sizeof(__Pyx_pad_longdouble) -
sizeof(
long double);
25788 case 'P':
case 'O':
return sizeof(__Pyx_pad_void_p) -
sizeof(
void*);
25790 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25794 static char __Pyx_BufFmt_TypeCharToGroup(
char ch,
int is_complex) {
25798 case 'b':
case 'h':
case 'i':
25799 case 'l':
case 'q':
case 's':
case 'p':
25801 case '?':
case 'B':
case 'H':
case 'I':
case 'L':
case 'Q':
25803 case 'f':
case 'd':
case 'g':
25804 return (is_complex ?
'C' :
'R');
25810 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25815 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
25816 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
25817 const char* expected;
25819 if (ctx->head == NULL) {
25823 expected = ctx->head->field->type->name;
25826 PyErr_Format(PyExc_ValueError,
25827 "Buffer dtype mismatch, expected %s%s%s but got %s",
25828 quote, expected, quote,
25829 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
25831 __Pyx_StructField* field = ctx->head->field;
25832 __Pyx_StructField* parent = (ctx->head - 1)->field;
25833 PyErr_Format(PyExc_ValueError,
25834 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
25835 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
25836 parent->type->name, field->name);
25839 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
25841 size_t size, offset, arraysize = 1;
25842 if (ctx->enc_type == 0)
return 0;
25843 if (ctx->head->field->type->arraysize[0]) {
25845 if (ctx->enc_type ==
's' || ctx->enc_type ==
'p') {
25846 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
25848 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
25849 PyErr_Format(PyExc_ValueError,
25850 "Expected a dimension of size %zu, got %zu",
25851 ctx->head->field->type->arraysize[0], ctx->enc_count);
25855 if (!ctx->is_valid_array) {
25856 PyErr_Format(PyExc_ValueError,
"Expected %d dimensions, got %d",
25857 ctx->head->field->type->ndim, ndim);
25860 for (i = 0; i < ctx->head->field->type->ndim; i++) {
25861 arraysize *= ctx->head->field->type->arraysize[i];
25863 ctx->is_valid_array = 0;
25864 ctx->enc_count = 1;
25866 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
25868 __Pyx_StructField* field = ctx->head->field;
25869 __Pyx_TypeInfo* type = field->type;
25870 if (ctx->enc_packmode ==
'@' || ctx->enc_packmode ==
'^') {
25871 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
25873 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
25875 if (ctx->enc_packmode ==
'@') {
25876 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
25877 size_t align_mod_offset;
25878 if (align_at == 0)
return -1;
25879 align_mod_offset = ctx->fmt_offset % align_at;
25880 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
25881 if (ctx->struct_alignment == 0)
25882 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
25885 if (type->size != size || type->typegroup != group) {
25886 if (type->typegroup ==
'C' && type->fields != NULL) {
25887 size_t parent_offset = ctx->head->parent_offset + field->offset;
25889 ctx->head->field = type->fields;
25890 ctx->head->parent_offset = parent_offset;
25893 if ((type->typegroup ==
'H' || group ==
'H') && type->size == size) {
25895 __Pyx_BufFmt_RaiseExpected(ctx);
25899 offset = ctx->head->parent_offset + field->offset;
25900 if (ctx->fmt_offset != offset) {
25901 PyErr_Format(PyExc_ValueError,
25902 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T
"d but %" CYTHON_FORMAT_SSIZE_T
"d expected",
25903 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
25906 ctx->fmt_offset += size;
25908 ctx->fmt_offset += (arraysize - 1) * size;
25911 if (field == &ctx->root) {
25913 if (ctx->enc_count != 0) {
25914 __Pyx_BufFmt_RaiseExpected(ctx);
25919 ctx->head->field = ++field;
25920 if (field->type == NULL) {
25922 field = ctx->head->field;
25924 }
else if (field->type->typegroup ==
'S') {
25925 size_t parent_offset = ctx->head->parent_offset + field->offset;
25926 if (field->type->fields->type == NULL)
continue;
25927 field = field->type->fields;
25929 ctx->head->field = field;
25930 ctx->head->parent_offset = parent_offset;
25936 }
while (ctx->enc_count);
25938 ctx->is_complex = 0;
25942 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx,
const char** tsp)
25944 const char *ts = *tsp;
25945 int i = 0, number, ndim;
25947 if (ctx->new_count != 1) {
25948 PyErr_SetString(PyExc_ValueError,
25949 "Cannot handle repeated arrays in format string");
25952 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
25953 ndim = ctx->head->field->type->ndim;
25954 while (*ts && *ts !=
')') {
25956 case ' ':
case '\f':
case '\r':
case '\n':
case '\t':
case '\v':
continue;
25959 number = __Pyx_BufFmt_ExpectNumber(&ts);
25960 if (number == -1)
return NULL;
25961 if (i < ndim && (
size_t) number != ctx->head->field->type->arraysize[i])
25962 return PyErr_Format(PyExc_ValueError,
25963 "Expected a dimension of size %zu, got %d",
25964 ctx->head->field->type->arraysize[i], number);
25965 if (*ts !=
',' && *ts !=
')')
25966 return PyErr_Format(PyExc_ValueError,
25967 "Expected a comma in format string, got '%c'", *ts);
25968 if (*ts ==
',') ts++;
25972 return PyErr_Format(PyExc_ValueError,
"Expected %d dimension(s), got %d",
25973 ctx->head->field->type->ndim, i);
25975 PyErr_SetString(PyExc_ValueError,
25976 "Unexpected end of format string, expected ')'");
25979 ctx->is_valid_array = 1;
25980 ctx->new_count = 1;
25984 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts) {
25989 if (ctx->enc_type != 0 && ctx->head == NULL) {
25990 __Pyx_BufFmt_RaiseExpected(ctx);
25993 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
25994 if (ctx->head != NULL) {
25995 __Pyx_BufFmt_RaiseExpected(ctx);
26005 if (!__Pyx_Is_Little_Endian()) {
26006 PyErr_SetString(PyExc_ValueError,
"Little-endian buffer not supported on big-endian compiler");
26009 ctx->new_packmode =
'=';
26014 if (__Pyx_Is_Little_Endian()) {
26015 PyErr_SetString(PyExc_ValueError,
"Big-endian buffer not supported on little-endian compiler");
26018 ctx->new_packmode =
'=';
26024 ctx->new_packmode = *ts++;
26028 const char* ts_after_sub;
26029 size_t i, struct_count = ctx->new_count;
26030 size_t struct_alignment = ctx->struct_alignment;
26031 ctx->new_count = 1;
26034 PyErr_SetString(PyExc_ValueError,
"Buffer acquisition: Expected '{' after 'T'");
26037 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26039 ctx->enc_count = 0;
26040 ctx->struct_alignment = 0;
26043 for (i = 0; i != struct_count; ++i) {
26044 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
26045 if (!ts_after_sub)
return NULL;
26048 if (struct_alignment) ctx->struct_alignment = struct_alignment;
26053 size_t alignment = ctx->struct_alignment;
26055 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26057 if (alignment && ctx->fmt_offset % alignment) {
26058 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
26063 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26064 ctx->fmt_offset += ctx->new_count;
26065 ctx->new_count = 1;
26066 ctx->enc_count = 0;
26068 ctx->enc_packmode = ctx->new_packmode;
26074 if (*ts !=
'f' && *ts !=
'd' && *ts !=
'g') {
26075 __Pyx_BufFmt_RaiseUnexpectedChar(
'Z');
26078 CYTHON_FALLTHROUGH;
26079 case '?':
case 'c':
case 'b':
case 'B':
case 'h':
case 'H':
case 'i':
case 'I':
26080 case 'l':
case 'L':
case 'q':
case 'Q':
26081 case 'f':
case 'd':
case 'g':
26082 case 'O':
case 'p':
26083 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
26084 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
26085 ctx->enc_count += ctx->new_count;
26086 ctx->new_count = 1;
26091 CYTHON_FALLTHROUGH;
26093 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26094 ctx->enc_count = ctx->new_count;
26095 ctx->enc_packmode = ctx->new_packmode;
26096 ctx->enc_type = *ts;
26097 ctx->is_complex = got_Z;
26099 ctx->new_count = 1;
26104 while(*ts !=
':') ++ts;
26108 if (!__pyx_buffmt_parse_array(ctx, &ts))
return NULL;
26112 int number = __Pyx_BufFmt_ExpectNumber(&ts);
26113 if (number == -1)
return NULL;
26114 ctx->new_count = (size_t)number;
26122 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
26129 if (a->size != b->size || a->typegroup != b->typegroup ||
26130 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
26131 if (a->typegroup ==
'H' || b->typegroup ==
'H') {
26132 return a->size == b->size;
26138 for (i = 0; i < a->ndim; i++)
26139 if (a->arraysize[i] != b->arraysize[i])
26142 if (a->typegroup ==
'S') {
26143 if (a->flags != b->flags)
26145 if (a->fields || b->fields) {
26146 if (!(a->fields && b->fields))
26148 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
26149 __Pyx_StructField *field_a = a->fields + i;
26150 __Pyx_StructField *field_b = b->fields + i;
26151 if (field_a->offset != field_b->offset ||
26152 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
26155 return !a->fields[i].type && !b->fields[i].type;
26163 __pyx_check_strides(Py_buffer *buf,
int dim,
int ndim,
int spec)
26165 if (buf->shape[dim] <= 1)
26167 if (buf->strides) {
26168 if (spec & __Pyx_MEMVIEW_CONTIG) {
26169 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
26170 if (unlikely(buf->strides[dim] !=
sizeof(
void *))) {
26171 PyErr_Format(PyExc_ValueError,
26172 "Buffer is not indirectly contiguous "
26173 "in dimension %d.", dim);
26176 }
else if (unlikely(buf->strides[dim] != buf->itemsize)) {
26177 PyErr_SetString(PyExc_ValueError,
26178 "Buffer and memoryview are not contiguous "
26179 "in the same dimension.");
26183 if (spec & __Pyx_MEMVIEW_FOLLOW) {
26184 Py_ssize_t stride = buf->strides[dim];
26187 if (unlikely(stride < buf->itemsize)) {
26188 PyErr_SetString(PyExc_ValueError,
26189 "Buffer and memoryview are not contiguous "
26190 "in the same dimension.");
26195 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
26196 PyErr_Format(PyExc_ValueError,
26197 "C-contiguous buffer is not contiguous in "
26198 "dimension %d", dim);
26200 }
else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
26201 PyErr_Format(PyExc_ValueError,
26202 "C-contiguous buffer is not indirect in "
26203 "dimension %d", dim);
26205 }
else if (unlikely(buf->suboffsets)) {
26206 PyErr_SetString(PyExc_ValueError,
26207 "Buffer exposes suboffsets but no strides");
26216 __pyx_check_suboffsets(Py_buffer *buf,
int dim, CYTHON_UNUSED
int ndim,
int spec)
26218 if (spec & __Pyx_MEMVIEW_DIRECT) {
26219 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
26220 PyErr_Format(PyExc_ValueError,
26221 "Buffer not compatible with direct access "
26222 "in dimension %d.", dim);
26226 if (spec & __Pyx_MEMVIEW_PTR) {
26227 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
26228 PyErr_Format(PyExc_ValueError,
26229 "Buffer is not indirectly accessible "
26230 "in dimension %d.", dim);
26239 __pyx_verify_contig(Py_buffer *buf,
int ndim,
int c_or_f_flag)
26242 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
26243 Py_ssize_t stride = 1;
26244 for (i = 0; i < ndim; i++) {
26245 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26246 PyErr_SetString(PyExc_ValueError,
26247 "Buffer not fortran contiguous.");
26250 stride = stride * buf->shape[i];
26252 }
else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
26253 Py_ssize_t stride = 1;
26254 for (i = ndim - 1; i >- 1; i--) {
26255 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26256 PyErr_SetString(PyExc_ValueError,
26257 "Buffer not C contiguous.");
26260 stride = stride * buf->shape[i];
26267 static int __Pyx_ValidateAndInit_memviewslice(
26272 __Pyx_TypeInfo *dtype,
26273 __Pyx_BufFmt_StackElem stack[],
26274 __Pyx_memviewslice *memviewslice,
26275 PyObject *original_obj)
26277 struct __pyx_memoryview_obj *memview, *new_memview;
26278 __Pyx_RefNannyDeclarations
26280 int i, spec = 0, retval = -1;
26281 __Pyx_BufFmt_Context ctx;
26282 int from_memoryview = __pyx_memoryview_check(original_obj);
26283 __Pyx_RefNannySetupContext(
"ValidateAndInit_memviewslice", 0);
26284 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((
struct __pyx_memoryview_obj *)
26285 original_obj)->typeinfo)) {
26286 memview = (
struct __pyx_memoryview_obj *) original_obj;
26287 new_memview = NULL;
26289 memview = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26290 original_obj, buf_flags, 0, dtype);
26291 new_memview = memview;
26292 if (unlikely(!memview))
26295 buf = &memview->view;
26296 if (unlikely(buf->ndim != ndim)) {
26297 PyErr_Format(PyExc_ValueError,
26298 "Buffer has wrong number of dimensions (expected %d, got %d)",
26303 __Pyx_BufFmt_Init(&ctx, stack, dtype);
26304 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format)))
goto fail;
26306 if (unlikely((
unsigned) buf->itemsize != dtype->size)) {
26307 PyErr_Format(PyExc_ValueError,
26308 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T
"u byte%s) "
26309 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T
"u byte%s)",
26311 (buf->itemsize > 1) ?
"s" :
"",
26314 (dtype->size > 1) ?
"s" :
"");
26317 if (buf->len > 0) {
26318 for (i = 0; i < ndim; i++) {
26319 spec = axes_specs[i];
26320 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
26322 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
26325 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
26328 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
26329 new_memview != NULL) == -1)) {
26335 Py_XDECREF(new_memview);
26338 __Pyx_RefNannyFinishContext();
26343 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj,
int writable_flag) {
26344 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26345 __Pyx_BufFmt_StackElem stack[1];
26346 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26348 if (obj == Py_None) {
26349 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26352 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26353 PyBUF_RECORDS_RO | writable_flag, 1,
26354 &__Pyx_TypeInfo_float, stack,
26356 if (unlikely(retcode == -1))
26360 result.memview = NULL;
26361 result.data = NULL;
26366 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *obj,
int writable_flag) {
26367 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26368 __Pyx_BufFmt_StackElem stack[1];
26369 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
26371 if (obj == Py_None) {
26372 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26375 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
26376 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
26377 &__Pyx_TypeInfo_float, stack,
26379 if (unlikely(retcode == -1))
26383 result.memview = NULL;
26384 result.data = NULL;
26389 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj,
int writable_flag) {
26390 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26391 __Pyx_BufFmt_StackElem stack[1];
26392 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26394 if (obj == Py_None) {
26395 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26398 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26399 PyBUF_RECORDS_RO | writable_flag, 1,
26400 &__Pyx_TypeInfo_int, stack,
26402 if (unlikely(retcode == -1))
26406 result.memview = NULL;
26407 result.data = NULL;
26412 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj,
int writable_flag) {
26413 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26414 __Pyx_BufFmt_StackElem stack[1];
26415 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26417 if (obj == Py_None) {
26418 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26421 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26422 PyBUF_RECORDS_RO | writable_flag, 1,
26423 &__Pyx_TypeInfo_double, stack,
26425 if (unlikely(retcode == -1))
26429 result.memview = NULL;
26430 result.data = NULL;
26435 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *obj,
int writable_flag) {
26436 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26437 __Pyx_BufFmt_StackElem stack[1];
26438 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
26440 if (obj == Py_None) {
26441 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26444 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
26445 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
26446 &__Pyx_TypeInfo_double, stack,
26448 if (unlikely(retcode == -1))
26452 result.memview = NULL;
26453 result.data = NULL;
26458 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(PyObject *obj,
int writable_flag) {
26459 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26460 __Pyx_BufFmt_StackElem stack[1];
26461 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26463 if (obj == Py_None) {
26464 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26467 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26468 PyBUF_RECORDS_RO | writable_flag, 1,
26469 &__Pyx_TypeInfo_long__double, stack,
26471 if (unlikely(retcode == -1))
26475 result.memview = NULL;
26476 result.data = NULL;
26481 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_long__double(PyObject *obj,
int writable_flag) {
26482 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26483 __Pyx_BufFmt_StackElem stack[1];
26484 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
26486 if (obj == Py_None) {
26487 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26490 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
26491 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
26492 &__Pyx_TypeInfo_long__double, stack,
26494 if (unlikely(retcode == -1))
26498 result.memview = NULL;
26499 result.data = NULL;
26504 #if CYTHON_CCOMPLEX
26506 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26507 return ::std::complex< float >(x, y);
26510 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26511 return x + y*(__pyx_t_float_complex)_Complex_I;
26515 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26516 __pyx_t_float_complex z;
26524 #if CYTHON_CCOMPLEX
26526 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26527 return (a.real == b.real) && (a.imag == b.imag);
26529 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26530 __pyx_t_float_complex z;
26531 z.real = a.real + b.real;
26532 z.imag = a.imag + b.imag;
26535 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26536 __pyx_t_float_complex z;
26537 z.real = a.real - b.real;
26538 z.imag = a.imag - b.imag;
26541 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26542 __pyx_t_float_complex z;
26543 z.real = a.real * b.real - a.imag * b.imag;
26544 z.imag = a.real * b.imag + a.imag * b.real;
26548 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26550 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26551 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
26552 if (b.real == 0 && b.imag == 0) {
26553 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
26555 float r = b.imag / b.real;
26556 float s = (float)(1.0) / (b.real + b.imag * r);
26557 return __pyx_t_float_complex_from_parts(
26558 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26561 float r = b.real / b.imag;
26562 float s = (float)(1.0) / (b.imag + b.real * r);
26563 return __pyx_t_float_complex_from_parts(
26564 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26568 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26570 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26572 float denom = b.real * b.real + b.imag * b.imag;
26573 return __pyx_t_float_complex_from_parts(
26574 (a.real * b.real + a.imag * b.imag) / denom,
26575 (a.imag * b.real - a.real * b.imag) / denom);
26579 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
26580 __pyx_t_float_complex z;
26585 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
26586 return (a.real == 0) && (a.imag == 0);
26588 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
26589 __pyx_t_float_complex z;
26595 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex z) {
26596 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26597 return sqrtf(z.real*z.real + z.imag*z.imag);
26599 return hypotf(z.real, z.imag);
26602 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26603 __pyx_t_float_complex z;
26604 float r, lnr, theta, z_r, z_theta;
26605 if (b.imag == 0 && b.real == (
int)b.real) {
26607 float denom = a.real * a.real + a.imag * a.imag;
26608 a.real = a.real / denom;
26609 a.imag = -a.imag / denom;
26612 switch ((
int)b.real) {
26620 return __Pyx_c_prod_float(a, a);
26622 z = __Pyx_c_prod_float(a, a);
26623 return __Pyx_c_prod_float(z, a);
26625 z = __Pyx_c_prod_float(a, a);
26626 return __Pyx_c_prod_float(z, z);
26632 }
else if ((b.imag == 0) && (a.real >= 0)) {
26633 z.real = powf(a.real, b.real);
26636 }
else if (a.real > 0) {
26641 theta = atan2f(0.0, -1.0);
26644 r = __Pyx_c_abs_float(a);
26645 theta = atan2f(a.imag, a.real);
26648 z_r = expf(lnr * b.real - theta * b.imag);
26649 z_theta = theta * b.real + lnr * b.imag;
26650 z.real = z_r * cosf(z_theta);
26651 z.imag = z_r * sinf(z_theta);
26658 #if CYTHON_CCOMPLEX
26660 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26661 return ::std::complex< double >(x, y);
26664 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26665 return x + y*(__pyx_t_double_complex)_Complex_I;
26669 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26670 __pyx_t_double_complex z;
26678 #if CYTHON_CCOMPLEX
26680 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26681 return (a.real == b.real) && (a.imag == b.imag);
26683 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26684 __pyx_t_double_complex z;
26685 z.real = a.real + b.real;
26686 z.imag = a.imag + b.imag;
26689 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26690 __pyx_t_double_complex z;
26691 z.real = a.real - b.real;
26692 z.imag = a.imag - b.imag;
26695 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26696 __pyx_t_double_complex z;
26697 z.real = a.real * b.real - a.imag * b.imag;
26698 z.imag = a.real * b.imag + a.imag * b.real;
26702 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26704 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26705 }
else if (fabs(b.real) >= fabs(b.imag)) {
26706 if (b.real == 0 && b.imag == 0) {
26707 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
26709 double r = b.imag / b.real;
26710 double s = (double)(1.0) / (b.real + b.imag * r);
26711 return __pyx_t_double_complex_from_parts(
26712 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26715 double r = b.real / b.imag;
26716 double s = (double)(1.0) / (b.imag + b.real * r);
26717 return __pyx_t_double_complex_from_parts(
26718 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26722 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26724 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26726 double denom = b.real * b.real + b.imag * b.imag;
26727 return __pyx_t_double_complex_from_parts(
26728 (a.real * b.real + a.imag * b.imag) / denom,
26729 (a.imag * b.real - a.real * b.imag) / denom);
26733 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
26734 __pyx_t_double_complex z;
26739 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
26740 return (a.real == 0) && (a.imag == 0);
26742 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
26743 __pyx_t_double_complex z;
26749 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex z) {
26750 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26751 return sqrt(z.real*z.real + z.imag*z.imag);
26753 return hypot(z.real, z.imag);
26756 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26757 __pyx_t_double_complex z;
26758 double r, lnr, theta, z_r, z_theta;
26759 if (b.imag == 0 && b.real == (
int)b.real) {
26761 double denom = a.real * a.real + a.imag * a.imag;
26762 a.real = a.real / denom;
26763 a.imag = -a.imag / denom;
26766 switch ((
int)b.real) {
26774 return __Pyx_c_prod_double(a, a);
26776 z = __Pyx_c_prod_double(a, a);
26777 return __Pyx_c_prod_double(z, a);
26779 z = __Pyx_c_prod_double(a, a);
26780 return __Pyx_c_prod_double(z, z);
26786 }
else if ((b.imag == 0) && (a.real >= 0)) {
26787 z.real = pow(a.real, b.real);
26790 }
else if (a.real > 0) {
26795 theta = atan2(0.0, -1.0);
26798 r = __Pyx_c_abs_double(a);
26799 theta = atan2(a.imag, a.real);
26802 z_r = exp(lnr * b.real - theta * b.imag);
26803 z_theta = theta * b.real + lnr * b.imag;
26804 z.real = z_r * cos(z_theta);
26805 z.imag = z_r * sin(z_theta);
26812 static __Pyx_memviewslice
26813 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
26814 const char *mode,
int ndim,
26815 size_t sizeof_dtype,
int contig_flag,
26816 int dtype_is_object)
26818 __Pyx_RefNannyDeclarations
26820 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
26821 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
26822 Py_buffer *buf = &from_memview->view;
26823 PyObject *shape_tuple = NULL;
26824 PyObject *temp_int = NULL;
26825 struct __pyx_array_obj *array_obj = NULL;
26826 struct __pyx_memoryview_obj *memview_obj = NULL;
26827 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
26828 for (i = 0; i < ndim; i++) {
26829 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
26830 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with "
26831 "indirect dimensions (axis %d)", i);
26835 shape_tuple = PyTuple_New(ndim);
26836 if (unlikely(!shape_tuple)) {
26839 __Pyx_GOTREF(shape_tuple);
26840 for(i = 0; i < ndim; i++) {
26841 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
26842 if(unlikely(!temp_int)) {
26845 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
26849 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
26850 if (unlikely(!array_obj)) {
26853 __Pyx_GOTREF(array_obj);
26854 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26855 (PyObject *) array_obj, contig_flag,
26857 from_mvs->memview->typeinfo);
26858 if (unlikely(!memview_obj))
26860 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
26862 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
26863 dtype_is_object) < 0))
26867 __Pyx_XDECREF(new_mvs.memview);
26868 new_mvs.memview = NULL;
26869 new_mvs.data = NULL;
26871 __Pyx_XDECREF(shape_tuple);
26872 __Pyx_XDECREF(temp_int);
26873 __Pyx_XDECREF(array_obj);
26874 __Pyx_RefNannyFinishContext();
26879 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
26880 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26881 #pragma GCC diagnostic push
26882 #pragma GCC diagnostic ignored "-Wconversion"
26884 const int neg_one = (int) -1, const_zero = (
int) 0;
26885 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26886 #pragma GCC diagnostic pop
26888 const int is_unsigned = neg_one > const_zero;
26889 #if PY_MAJOR_VERSION < 3
26890 if (likely(PyInt_Check(x))) {
26891 if (
sizeof(
int) <
sizeof(long)) {
26892 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
26894 long val = PyInt_AS_LONG(x);
26895 if (is_unsigned && unlikely(val < 0)) {
26896 goto raise_neg_overflow;
26902 if (likely(PyLong_Check(x))) {
26904 #if CYTHON_USE_PYLONG_INTERNALS
26905 const digit* digits = ((PyLongObject*)x)->ob_digit;
26906 switch (Py_SIZE(x)) {
26907 case 0:
return (
int) 0;
26908 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
26910 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
26911 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
26912 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26913 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
26914 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
26919 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
26920 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
26921 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26922 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
26923 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26928 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
26929 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
26930 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26931 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
26932 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
26938 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
26939 if (unlikely(Py_SIZE(x) < 0)) {
26940 goto raise_neg_overflow;
26944 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26945 if (unlikely(result < 0))
26947 if (unlikely(result == 1))
26948 goto raise_neg_overflow;
26951 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
26952 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
26953 #ifdef HAVE_LONG_LONG
26954 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
26955 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26959 #if CYTHON_USE_PYLONG_INTERNALS
26960 const digit* digits = ((PyLongObject*)x)->ob_digit;
26961 switch (Py_SIZE(x)) {
26962 case 0:
return (
int) 0;
26963 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
26964 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
26966 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
26967 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
26968 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26969 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
26970 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
26975 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
26976 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
26977 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26978 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
26979 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
26984 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
26985 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
26986 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26987 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
26988 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26993 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
26994 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
26995 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26996 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
26997 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27002 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27003 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27004 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27005 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
27006 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27011 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
27012 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27013 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27014 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
27015 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27021 if (
sizeof(
int) <=
sizeof(long)) {
27022 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
27023 #ifdef HAVE_LONG_LONG
27024 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27025 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
27030 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27031 PyErr_SetString(PyExc_RuntimeError,
27032 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27035 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27036 #if PY_MAJOR_VERSION < 3
27037 if (likely(v) && !PyLong_Check(v)) {
27039 v = PyNumber_Long(tmp);
27044 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27045 unsigned char *bytes = (
unsigned char *)&val;
27046 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27047 bytes,
sizeof(val),
27048 is_little, !is_unsigned);
27058 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27059 if (!tmp)
return (
int) -1;
27060 val = __Pyx_PyInt_As_int(tmp);
27065 PyErr_SetString(PyExc_OverflowError,
27066 "value too large to convert to int");
27068 raise_neg_overflow:
27069 PyErr_SetString(PyExc_OverflowError,
27070 "can't convert negative value to int");
27075 static CYTHON_INLINE int64_t __Pyx_PyInt_As_int64_t(PyObject *x) {
27076 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27077 #pragma GCC diagnostic push
27078 #pragma GCC diagnostic ignored "-Wconversion"
27080 const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
27081 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27082 #pragma GCC diagnostic pop
27084 const int is_unsigned = neg_one > const_zero;
27085 #if PY_MAJOR_VERSION < 3
27086 if (likely(PyInt_Check(x))) {
27087 if (
sizeof(int64_t) <
sizeof(long)) {
27088 __PYX_VERIFY_RETURN_INT(int64_t,
long, PyInt_AS_LONG(x))
27090 long val = PyInt_AS_LONG(x);
27091 if (is_unsigned && unlikely(val < 0)) {
27092 goto raise_neg_overflow;
27094 return (int64_t) val;
27098 if (likely(PyLong_Check(x))) {
27100 #if CYTHON_USE_PYLONG_INTERNALS
27101 const digit* digits = ((PyLongObject*)x)->ob_digit;
27102 switch (Py_SIZE(x)) {
27103 case 0:
return (int64_t) 0;
27104 case 1: __PYX_VERIFY_RETURN_INT(int64_t, digit, digits[0])
27106 if (8 *
sizeof(int64_t) > 1 * PyLong_SHIFT) {
27107 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27108 __PYX_VERIFY_RETURN_INT(int64_t,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27109 }
else if (8 *
sizeof(int64_t) >= 2 * PyLong_SHIFT) {
27110 return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
27115 if (8 *
sizeof(int64_t) > 2 * PyLong_SHIFT) {
27116 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27117 __PYX_VERIFY_RETURN_INT(int64_t,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27118 }
else if (8 *
sizeof(int64_t) >= 3 * PyLong_SHIFT) {
27119 return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
27124 if (8 *
sizeof(int64_t) > 3 * PyLong_SHIFT) {
27125 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27126 __PYX_VERIFY_RETURN_INT(int64_t,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27127 }
else if (8 *
sizeof(int64_t) >= 4 * PyLong_SHIFT) {
27128 return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
27134 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
27135 if (unlikely(Py_SIZE(x) < 0)) {
27136 goto raise_neg_overflow;
27140 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27141 if (unlikely(result < 0))
27142 return (int64_t) -1;
27143 if (unlikely(result == 1))
27144 goto raise_neg_overflow;
27147 if (
sizeof(int64_t) <=
sizeof(
unsigned long)) {
27148 __PYX_VERIFY_RETURN_INT_EXC(int64_t,
unsigned long, PyLong_AsUnsignedLong(x))
27149 #ifdef HAVE_LONG_LONG
27150 }
else if (
sizeof(int64_t) <=
sizeof(
unsigned PY_LONG_LONG)) {
27151 __PYX_VERIFY_RETURN_INT_EXC(int64_t,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27155 #if CYTHON_USE_PYLONG_INTERNALS
27156 const digit* digits = ((PyLongObject*)x)->ob_digit;
27157 switch (Py_SIZE(x)) {
27158 case 0:
return (int64_t) 0;
27159 case -1: __PYX_VERIFY_RETURN_INT(int64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
27160 case 1: __PYX_VERIFY_RETURN_INT(int64_t, digit, +digits[0])
27162 if (8 *
sizeof(int64_t) - 1 > 1 * PyLong_SHIFT) {
27163 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27164 __PYX_VERIFY_RETURN_INT(int64_t,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27165 }
else if (8 *
sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
27166 return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
27171 if (8 *
sizeof(int64_t) > 1 * PyLong_SHIFT) {
27172 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27173 __PYX_VERIFY_RETURN_INT(int64_t,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27174 }
else if (8 *
sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
27175 return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
27180 if (8 *
sizeof(int64_t) - 1 > 2 * PyLong_SHIFT) {
27181 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27182 __PYX_VERIFY_RETURN_INT(int64_t,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27183 }
else if (8 *
sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
27184 return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
27189 if (8 *
sizeof(int64_t) > 2 * PyLong_SHIFT) {
27190 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27191 __PYX_VERIFY_RETURN_INT(int64_t,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27192 }
else if (8 *
sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
27193 return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
27198 if (8 *
sizeof(int64_t) - 1 > 3 * PyLong_SHIFT) {
27199 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27200 __PYX_VERIFY_RETURN_INT(int64_t,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27201 }
else if (8 *
sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
27202 return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
27207 if (8 *
sizeof(int64_t) > 3 * PyLong_SHIFT) {
27208 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27209 __PYX_VERIFY_RETURN_INT(int64_t,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27210 }
else if (8 *
sizeof(int64_t) - 1 > 4 * PyLong_SHIFT) {
27211 return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
27217 if (
sizeof(int64_t) <=
sizeof(long)) {
27218 __PYX_VERIFY_RETURN_INT_EXC(int64_t,
long, PyLong_AsLong(x))
27219 #ifdef HAVE_LONG_LONG
27220 }
else if (
sizeof(int64_t) <=
sizeof(PY_LONG_LONG)) {
27221 __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
27226 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27227 PyErr_SetString(PyExc_RuntimeError,
27228 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27231 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27232 #if PY_MAJOR_VERSION < 3
27233 if (likely(v) && !PyLong_Check(v)) {
27235 v = PyNumber_Long(tmp);
27240 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27241 unsigned char *bytes = (
unsigned char *)&val;
27242 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27243 bytes,
sizeof(val),
27244 is_little, !is_unsigned);
27250 return (int64_t) -1;
27254 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27255 if (!tmp)
return (int64_t) -1;
27256 val = __Pyx_PyInt_As_int64_t(tmp);
27261 PyErr_SetString(PyExc_OverflowError,
27262 "value too large to convert to int64_t");
27263 return (int64_t) -1;
27264 raise_neg_overflow:
27265 PyErr_SetString(PyExc_OverflowError,
27266 "can't convert negative value to int64_t");
27267 return (int64_t) -1;
27271 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
27272 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27273 #pragma GCC diagnostic push
27274 #pragma GCC diagnostic ignored "-Wconversion"
27276 const long neg_one = (long) -1, const_zero = (
long) 0;
27277 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27278 #pragma GCC diagnostic pop
27280 const int is_unsigned = neg_one > const_zero;
27282 if (
sizeof(
long) <
sizeof(long)) {
27283 return PyInt_FromLong((
long) value);
27284 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
27285 return PyLong_FromUnsignedLong((
unsigned long) value);
27286 #ifdef HAVE_LONG_LONG
27287 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
27288 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27292 if (
sizeof(
long) <=
sizeof(
long)) {
27293 return PyInt_FromLong((
long) value);
27294 #ifdef HAVE_LONG_LONG
27295 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
27296 return PyLong_FromLongLong((PY_LONG_LONG) value);
27301 int one = 1;
int little = (int)*(
unsigned char *)&one;
27302 unsigned char *bytes = (
unsigned char *)&value;
27303 return _PyLong_FromByteArray(bytes,
sizeof(
long),
27304 little, !is_unsigned);
27309 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
27310 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27311 #pragma GCC diagnostic push
27312 #pragma GCC diagnostic ignored "-Wconversion"
27314 const int neg_one = (int) -1, const_zero = (
int) 0;
27315 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27316 #pragma GCC diagnostic pop
27318 const int is_unsigned = neg_one > const_zero;
27320 if (
sizeof(
int) <
sizeof(long)) {
27321 return PyInt_FromLong((
long) value);
27322 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
27323 return PyLong_FromUnsignedLong((
unsigned long) value);
27324 #ifdef HAVE_LONG_LONG
27325 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
27326 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27330 if (
sizeof(
int) <=
sizeof(
long)) {
27331 return PyInt_FromLong((
long) value);
27332 #ifdef HAVE_LONG_LONG
27333 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27334 return PyLong_FromLongLong((PY_LONG_LONG) value);
27339 int one = 1;
int little = (int)*(
unsigned char *)&one;
27340 unsigned char *bytes = (
unsigned char *)&value;
27341 return _PyLong_FromByteArray(bytes,
sizeof(
int),
27342 little, !is_unsigned);
27347 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
27348 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27349 #pragma GCC diagnostic push
27350 #pragma GCC diagnostic ignored "-Wconversion"
27352 const long neg_one = (long) -1, const_zero = (
long) 0;
27353 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27354 #pragma GCC diagnostic pop
27356 const int is_unsigned = neg_one > const_zero;
27357 #if PY_MAJOR_VERSION < 3
27358 if (likely(PyInt_Check(x))) {
27359 if (
sizeof(
long) <
sizeof(long)) {
27360 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
27362 long val = PyInt_AS_LONG(x);
27363 if (is_unsigned && unlikely(val < 0)) {
27364 goto raise_neg_overflow;
27370 if (likely(PyLong_Check(x))) {
27372 #if CYTHON_USE_PYLONG_INTERNALS
27373 const digit* digits = ((PyLongObject*)x)->ob_digit;
27374 switch (Py_SIZE(x)) {
27375 case 0:
return (
long) 0;
27376 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
27378 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
27379 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27380 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27381 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
27382 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
27387 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
27388 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27389 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27390 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
27391 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
27396 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
27397 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27398 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27399 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
27400 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
27406 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
27407 if (unlikely(Py_SIZE(x) < 0)) {
27408 goto raise_neg_overflow;
27412 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27413 if (unlikely(result < 0))
27415 if (unlikely(result == 1))
27416 goto raise_neg_overflow;
27419 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
27420 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
27421 #ifdef HAVE_LONG_LONG
27422 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
27423 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27427 #if CYTHON_USE_PYLONG_INTERNALS
27428 const digit* digits = ((PyLongObject*)x)->ob_digit;
27429 switch (Py_SIZE(x)) {
27430 case 0:
return (
long) 0;
27431 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
27432 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
27434 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
27435 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27436 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27437 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27438 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27443 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
27444 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27445 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27446 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27447 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27452 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27453 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27454 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27455 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27456 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27461 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
27462 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27463 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27464 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27465 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27470 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27471 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27472 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27473 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
27474 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27479 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
27480 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27481 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27482 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
27483 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27489 if (
sizeof(
long) <=
sizeof(long)) {
27490 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
27491 #ifdef HAVE_LONG_LONG
27492 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
27493 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
27498 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27499 PyErr_SetString(PyExc_RuntimeError,
27500 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27503 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27504 #if PY_MAJOR_VERSION < 3
27505 if (likely(v) && !PyLong_Check(v)) {
27507 v = PyNumber_Long(tmp);
27512 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27513 unsigned char *bytes = (
unsigned char *)&val;
27514 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27515 bytes,
sizeof(val),
27516 is_little, !is_unsigned);
27526 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27527 if (!tmp)
return (
long) -1;
27528 val = __Pyx_PyInt_As_long(tmp);
27533 PyErr_SetString(PyExc_OverflowError,
27534 "value too large to convert to long");
27536 raise_neg_overflow:
27537 PyErr_SetString(PyExc_OverflowError,
27538 "can't convert negative value to long");
27543 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
27544 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27545 #pragma GCC diagnostic push
27546 #pragma GCC diagnostic ignored "-Wconversion"
27548 const char neg_one = (char) -1, const_zero = (
char) 0;
27549 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27550 #pragma GCC diagnostic pop
27552 const int is_unsigned = neg_one > const_zero;
27553 #if PY_MAJOR_VERSION < 3
27554 if (likely(PyInt_Check(x))) {
27555 if (
sizeof(
char) <
sizeof(long)) {
27556 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
27558 long val = PyInt_AS_LONG(x);
27559 if (is_unsigned && unlikely(val < 0)) {
27560 goto raise_neg_overflow;
27566 if (likely(PyLong_Check(x))) {
27568 #if CYTHON_USE_PYLONG_INTERNALS
27569 const digit* digits = ((PyLongObject*)x)->ob_digit;
27570 switch (Py_SIZE(x)) {
27571 case 0:
return (
char) 0;
27572 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
27574 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
27575 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27576 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27577 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
27578 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
27583 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
27584 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27585 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27586 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
27587 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
27592 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
27593 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27594 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27595 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
27596 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
27602 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
27603 if (unlikely(Py_SIZE(x) < 0)) {
27604 goto raise_neg_overflow;
27608 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27609 if (unlikely(result < 0))
27611 if (unlikely(result == 1))
27612 goto raise_neg_overflow;
27615 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
27616 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
27617 #ifdef HAVE_LONG_LONG
27618 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
27619 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27623 #if CYTHON_USE_PYLONG_INTERNALS
27624 const digit* digits = ((PyLongObject*)x)->ob_digit;
27625 switch (Py_SIZE(x)) {
27626 case 0:
return (
char) 0;
27627 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
27628 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
27630 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
27631 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27632 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27633 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27634 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27639 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
27640 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27641 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27642 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27643 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27648 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27649 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27650 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27651 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27652 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27657 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
27658 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27659 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27660 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27661 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27666 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27667 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27668 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27669 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
27670 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27675 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
27676 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27677 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27678 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
27679 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27685 if (
sizeof(
char) <=
sizeof(long)) {
27686 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
27687 #ifdef HAVE_LONG_LONG
27688 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
27689 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
27694 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27695 PyErr_SetString(PyExc_RuntimeError,
27696 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27699 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27700 #if PY_MAJOR_VERSION < 3
27701 if (likely(v) && !PyLong_Check(v)) {
27703 v = PyNumber_Long(tmp);
27708 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27709 unsigned char *bytes = (
unsigned char *)&val;
27710 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27711 bytes,
sizeof(val),
27712 is_little, !is_unsigned);
27722 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27723 if (!tmp)
return (
char) -1;
27724 val = __Pyx_PyInt_As_char(tmp);
27729 PyErr_SetString(PyExc_OverflowError,
27730 "value too large to convert to char");
27732 raise_neg_overflow:
27733 PyErr_SetString(PyExc_OverflowError,
27734 "can't convert negative value to char");
27739 static int __Pyx_check_binary_version(
void) {
27741 int same=1, i, found_dot;
27742 const char* rt_from_call = Py_GetVersion();
27743 PyOS_snprintf(ctversion, 5,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
27745 for (i = 0; i < 4; i++) {
27746 if (!ctversion[i]) {
27747 same = (rt_from_call[i] <
'0' || rt_from_call[i] >
'9');
27750 if (rt_from_call[i] != ctversion[i]) {
27756 char rtversion[5] = {
'\0'};
27758 for (i=0; i<4; ++i) {
27759 if (rt_from_call[i] ==
'.') {
27760 if (found_dot)
break;
27762 }
else if (rt_from_call[i] <
'0' || rt_from_call[i] >
'9') {
27765 rtversion[i] = rt_from_call[i];
27767 PyOS_snprintf(message,
sizeof(message),
27768 "compiletime version %s of module '%.100s' "
27769 "does not match runtime version %s",
27770 ctversion, __Pyx_MODULE_NAME, rtversion);
27771 return PyErr_WarnEx(NULL, message, 1);
27777 static int __Pyx_ExportFunction(
const char *name,
void (*f)(
void),
const char *sig) {
27779 PyObject *cobj = 0;
27784 d = PyObject_GetAttrString(__pyx_m, (
char *)
"__pyx_capi__");
27791 if (PyModule_AddObject(__pyx_m, (
char *)
"__pyx_capi__", d) < 0)
27795 #if PY_VERSION_HEX >= 0x02070000
27796 cobj = PyCapsule_New(tmp.p, sig, 0);
27798 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (
void *)sig, 0);
27802 if (PyDict_SetItemString(d, name, cobj) < 0)
27814 #ifndef __PYX_HAVE_RT_ImportFunction_0_29_36
27815 #define __PYX_HAVE_RT_ImportFunction_0_29_36
27816 static int __Pyx_ImportFunction_0_29_36(PyObject *module,
const char *funcname,
void (**f)(
void),
const char *sig) {
27818 PyObject *cobj = 0;
27823 d = PyObject_GetAttrString(module, (
char *)
"__pyx_capi__");
27826 cobj = PyDict_GetItemString(d, funcname);
27828 PyErr_Format(PyExc_ImportError,
27829 "%.200s does not export expected C function %.200s",
27830 PyModule_GetName(module), funcname);
27833 #if PY_VERSION_HEX >= 0x02070000
27834 if (!PyCapsule_IsValid(cobj, sig)) {
27835 PyErr_Format(PyExc_TypeError,
27836 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
27837 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
27840 tmp.p = PyCapsule_GetPointer(cobj, sig);
27842 {
const char *desc, *s1, *s2;
27843 desc = (
const char *)PyCObject_GetDesc(cobj);
27846 s1 = desc; s2 = sig;
27847 while (*s1 !=
'\0' && *s1 == *s2) { s1++; s2++; }
27849 PyErr_Format(PyExc_TypeError,
27850 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
27851 PyModule_GetName(module), funcname, sig, desc);
27854 tmp.p = PyCObject_AsVoidPtr(cobj);}
27868 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
27870 #if PY_MAJOR_VERSION < 3
27871 if (t->is_unicode) {
27872 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
27873 }
else if (t->intern) {
27874 *t->p = PyString_InternFromString(t->s);
27876 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
27879 if (t->is_unicode | t->is_str) {
27881 *t->p = PyUnicode_InternFromString(t->s);
27882 }
else if (t->encoding) {
27883 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
27885 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
27888 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
27893 if (PyObject_Hash(*t->p) == -1)
27900 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
27901 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
27903 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
27905 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
27907 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27908 #if !CYTHON_PEP393_ENABLED
27909 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27911 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
27912 if (!defenc)
return NULL;
27913 defenc_c = PyBytes_AS_STRING(defenc);
27914 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27916 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
27918 for (c = defenc_c; c < end; c++) {
27919 if ((
unsigned char) (*c) >= 128) {
27920 PyUnicode_AsASCIIString(o);
27926 *length = PyBytes_GET_SIZE(defenc);
27930 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27931 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
27932 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27933 if (likely(PyUnicode_IS_ASCII(o))) {
27934 *length = PyUnicode_GET_LENGTH(o);
27935 return PyUnicode_AsUTF8(o);
27937 PyUnicode_AsASCIIString(o);
27941 return PyUnicode_AsUTF8AndSize(o, length);
27946 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27947 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27949 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27950 __Pyx_sys_getdefaultencoding_not_ascii &&
27952 PyUnicode_Check(o)) {
27953 return __Pyx_PyUnicode_AsStringAndSize(o, length);
27956 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
27957 if (PyByteArray_Check(o)) {
27958 *length = PyByteArray_GET_SIZE(o);
27959 return PyByteArray_AS_STRING(o);
27964 int r = PyBytes_AsStringAndSize(o, &result, length);
27965 if (unlikely(r < 0)) {
27972 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
27973 int is_true = x == Py_True;
27974 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
27975 else return PyObject_IsTrue(x);
27977 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
27979 if (unlikely(!x))
return -1;
27980 retval = __Pyx_PyObject_IsTrue(x);
27984 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
27985 #if PY_MAJOR_VERSION >= 3
27986 if (PyLong_Check(result)) {
27987 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
27988 "__int__ returned non-int (type %.200s). "
27989 "The ability to return an instance of a strict subclass of int "
27990 "is deprecated, and may be removed in a future version of Python.",
27991 Py_TYPE(result)->tp_name)) {
27998 PyErr_Format(PyExc_TypeError,
27999 "__%.4s__ returned non-%.4s (type %.200s)",
28000 type_name, type_name, Py_TYPE(result)->tp_name);
28004 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
28005 #if CYTHON_USE_TYPE_SLOTS
28006 PyNumberMethods *m;
28008 const char *name = NULL;
28009 PyObject *res = NULL;
28010 #if PY_MAJOR_VERSION < 3
28011 if (likely(PyInt_Check(x) || PyLong_Check(x)))
28013 if (likely(PyLong_Check(x)))
28015 return __Pyx_NewRef(x);
28016 #if CYTHON_USE_TYPE_SLOTS
28017 m = Py_TYPE(x)->tp_as_number;
28018 #if PY_MAJOR_VERSION < 3
28019 if (m && m->nb_int) {
28021 res = m->nb_int(x);
28023 else if (m && m->nb_long) {
28025 res = m->nb_long(x);
28028 if (likely(m && m->nb_int)) {
28030 res = m->nb_int(x);
28034 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
28035 res = PyNumber_Int(x);
28039 #if PY_MAJOR_VERSION < 3
28040 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
28042 if (unlikely(!PyLong_CheckExact(res))) {
28044 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
28047 else if (!PyErr_Occurred()) {
28048 PyErr_SetString(PyExc_TypeError,
28049 "an integer is required");
28053 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
28056 #if PY_MAJOR_VERSION < 3
28057 if (likely(PyInt_CheckExact(b))) {
28058 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
28059 return PyInt_AS_LONG(b);
28061 return PyInt_AsSsize_t(b);
28064 if (likely(PyLong_CheckExact(b))) {
28065 #if CYTHON_USE_PYLONG_INTERNALS
28066 const digit* digits = ((PyLongObject*)b)->ob_digit;
28067 const Py_ssize_t size = Py_SIZE(b);
28068 if (likely(__Pyx_sst_abs(size) <= 1)) {
28069 ival = likely(size) ? digits[0] : 0;
28070 if (size == -1) ival = -ival;
28075 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28076 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28080 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28081 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28085 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28086 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28090 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28091 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28095 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28096 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28100 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28101 return -(Py_ssize_t) (((((((((
size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28107 return PyLong_AsSsize_t(b);
28109 x = PyNumber_Index(b);
28111 ival = PyInt_AsSsize_t(x);
28115 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
28116 if (
sizeof(Py_hash_t) ==
sizeof(Py_ssize_t)) {
28117 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
28118 #if PY_MAJOR_VERSION < 3
28119 }
else if (likely(PyInt_CheckExact(o))) {
28120 return PyInt_AS_LONG(o);
28125 x = PyNumber_Index(o);
28127 ival = PyInt_AsLong(x);
28132 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
28133 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
28135 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
28136 return PyInt_FromSize_t(ival);
Base class for linear operators. This class serves as interface for all derived classes.
static FlagType c_trace_estimator(cLinearOperator< DataType > *A, DataType *parameters, const IndexType num_inquiries, const Function *matrix_function, const FlagType gram, const DataType exponent, const FlagType orthogonalize, const int64_t seed, const IndexType lanczos_degree, const DataType lanczos_tol, const IndexType min_num_samples, const IndexType max_num_samples, const DataType error_atol, const DataType error_rtol, const DataType confidence_level, const DataType outlier_significance_level, const IndexType num_threads, DataType *trace, DataType *error, DataType **samples, IndexType *processed_samples_indices, IndexType *num_samples_used, IndexType *num_outliers, FlagType *converged, float &alg_wall_time)
Stochastic Lanczos quadrature method to estimate trace of a function of a linear operator....
void lapack_sbdsdc(char *uplo, char *compq, int *n, float *d, float *e, float *u, int *ldu, float *vt, int *ldvt, float *q, int *iq, float *work, int *iwork, int *info)
void lapack_dstev(char *jobz, int *n, double *d, double *e, double *z, int *ldz, double *work, int *info)
void lapack_dbdsdc(char *uplo, char *compq, int *n, double *d, double *e, double *u, int *ldu, double *vt, int *ldvt, double *q, int *iq, double *work, int *iwork, int *info)
__PYX_EXTERN_C void lapack_sstev(char *, int *, float *, float *, float *, int *, float *, int *)
PyMODINIT_FUNC initpy_c_trace_estimator(void)